43 #include "../Core/util/NonMPL2.h" 45 #ifndef EIGEN_SIMPLICIAL_CHOLESKY_IMPL_H 46 #define EIGEN_SIMPLICIAL_CHOLESKY_IMPL_H 50 template<
typename Derived>
54 m_matrix.resize(size, size);
55 m_parent.resize(size);
56 m_nonZerosPerCol.resize(size);
60 for(
Index k = 0; k < size; ++k)
65 m_nonZerosPerCol[k] = 0;
66 for(
typename CholMatrixType::InnerIterator it(ap,k); it; ++it)
72 for(; tags[i] != k; i = m_parent[i])
75 if (m_parent[i] == -1)
77 m_nonZerosPerCol[i]++;
85 Index* Lp = m_matrix.outerIndexPtr();
87 for(
Index k = 0; k < size; ++k)
88 Lp[k+1] = Lp[k] + m_nonZerosPerCol[k] + (doLDLT ? 0 : 1);
90 m_matrix.resizeNonZeros(Lp[size]);
92 m_isInitialized =
true;
94 m_analysisIsOk =
true;
95 m_factorizationIsOk =
false;
99 template<
typename Derived>
100 template<
bool DoLDLT>
105 eigen_assert(m_analysisIsOk &&
"You must first call analyzePattern()");
111 const Index* Lp = m_matrix.outerIndexPtr();
112 Index* Li = m_matrix.innerIndexPtr();
113 Scalar* Lx = m_matrix.valuePtr();
120 m_diag.resize(DoLDLT ? size : 0);
122 for(
Index k = 0; k < size; ++k)
128 m_nonZerosPerCol[k] = 0;
129 for(
typename MatrixType::InnerIterator it(ap,k); it; ++it)
131 Index i = it.index();
136 for(len = 0; tags[i] != k; i = m_parent[i])
142 pattern[--top] = pattern[--len];
150 for(; top < size; ++top)
152 Index i = pattern[top];
159 l_ki = yi / m_diag[i];
161 yi = l_ki = yi / Lx[Lp[i]];
163 Index p2 = Lp[i] + m_nonZerosPerCol[i];
165 for(p = Lp[i] + (DoLDLT ? 0 : 1); p < p2; ++p)
170 ++m_nonZerosPerCol[i];
183 Index p = Lp[k] + m_nonZerosPerCol[k]++;
194 m_factorizationIsOk =
true;
199 #endif // EIGEN_SIMPLICIAL_CHOLESKY_IMPL_H const AutoDiffScalar< DerType > & conj(const AutoDiffScalar< DerType > &x)
IntermediateState sqrt(const Expression &arg)
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
iterative scaling algorithm to equilibrate rows and column norms in matrices
void analyzePattern_preordered(const CholMatrixType &a, bool doLDLT)
RealReturnType real() const
MatrixType::Scalar Scalar
MatrixType::RealScalar RealScalar
void factorize_preordered(const CholMatrixType &a)