Sparse module: enable support for incomplete cholesky factorization in CHOLMOD backend.

This commit is contained in:
Gael Guennebaud 2008-10-05 13:45:43 +00:00
parent 3c155ab073
commit b8fc1edb2c

View File

@ -104,14 +104,14 @@ void SparseCholesky<MatrixType>::computeUsingCholmod(const MatrixType& a)
cholmod_common c; cholmod_common c;
cholmod_start(&c); cholmod_start(&c);
cholmod_sparse A = const_cast<MatrixType&>(a).asCholmodMatrix(); cholmod_sparse A = const_cast<MatrixType&>(a).asCholmodMatrix();
std::vector<int> perm(a.cols()); if (!(m_flags&CholPartial))
for (int i=0; i<a.cols(); ++i) {
perm[i] = i; c.nmethods = 1;
c.nmethods = 1; c.method [0].ordering = CHOLMOD_NATURAL;
c.method [0].ordering = CHOLMOD_NATURAL; c.postorder = 0;
c.postorder = 0; }
c.final_ll = 1; c.final_ll = 1;
cholmod_factor *L = cholmod_analyze_p(&A, &perm[0], &perm[0], a.cols(), &c); cholmod_factor *L = cholmod_analyze(&A, &c);
cholmod_factorize(&A, L, &c); cholmod_factorize(&A, L, &c);
cholmod_sparse* cmRes = cholmod_factor_to_sparse(L, &c); cholmod_sparse* cmRes = cholmod_factor_to_sparse(L, &c);
m_matrix = CholMatrixType::Map(*cmRes); m_matrix = CholMatrixType::Map(*cmRes);