67 typedef typename Lhs::Type Type;
68 if(A.rows() != A.cols())
71 D.
resize(A.rows(), A.cols());
72 L.
resize(A.rows(), A.cols());
74 for (
int j=A.beginCols(); j<A.endCols(); ++j )
77 for (
int k=A.beginCols(); k<j; ++k) { sum1 -= L(j,k) * L(j,k) * D[k];}
81 for (
int i=j+1; i<A.endRows(); ++i)
84 for (
int k=A.beginCols(); k<j; ++k) { sum2 -= L(i,k)*L(j,k)* D[k];}
85 L(i,j) = sum1 ? sum2/sum1 : sum2;
In this file, we define Array2DDiagonal class.
In this file we define the Array2DLowerTriangular class.
In this file we implement the final class CArraySquare.
#define STKRUNTIME_ERROR_NO_ARG(Where, Error)
This file include all the other header files of the project Sdk.
Derivation of the Array2DDiagonal class for square arrays of Real.
Declaration of the lower triangular matrix class.
base class for template evaluation expressions and visitors.
Derived & resize(Range const &I, Range const &J)
resize the array.
bool cholesky(ExprBase< Lhs > const &A, Array2DDiagonal< typename Lhs::Type > &D, Array2DLowerTriangular< typename Lhs::Type > &L)
Compute the Cholesky decomposition of a symmetric matrix.
The namespace STK is the main domain space of the Statistical ToolKit project.