mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-25 22:34:30 +08:00
fix various Taucs and Cholmod issues (they have not been tested for a while)
This commit is contained in:
parent
41f80b26cb
commit
1119f846cf
@ -108,7 +108,7 @@ cholmod_dense ei_cholmod_map_eigen_to_dense(MatrixBase<Derived>& mat)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Scalar, int Flags>
|
template<typename Scalar, int Flags>
|
||||||
MappedSparseMatrix<Scalar,Flags>::MappedSparseMatrix(taucs_ccs_matrix& taucsMat)
|
MappedSparseMatrix<Scalar,Flags>::MappedSparseMatrix(cholmod_sparse& cm)
|
||||||
{
|
{
|
||||||
m_innerSize = cm.nrow;
|
m_innerSize = cm.nrow;
|
||||||
m_outerSize = cm.ncol;
|
m_outerSize = cm.ncol;
|
||||||
@ -205,7 +205,7 @@ SparseLLT<MatrixType,Cholmod>::matrixL() const
|
|||||||
ei_assert(!(m_status & SupernodalFactorIsDirty));
|
ei_assert(!(m_status & SupernodalFactorIsDirty));
|
||||||
|
|
||||||
cholmod_sparse* cmRes = cholmod_factor_to_sparse(m_cholmodFactor, &m_cholmod);
|
cholmod_sparse* cmRes = cholmod_factor_to_sparse(m_cholmodFactor, &m_cholmod);
|
||||||
const_cast<typename Base::CholMatrixType&>(m_matrix) = Base::CholMatrixType::Map(*cmRes);
|
const_cast<typename Base::CholMatrixType&>(m_matrix) = MappedSparseMatrix(*cmRes);
|
||||||
free(cmRes);
|
free(cmRes);
|
||||||
|
|
||||||
m_status = (m_status & ~MatrixLIsDirty);
|
m_status = (m_status & ~MatrixLIsDirty);
|
||||||
|
@ -32,9 +32,9 @@ taucs_ccs_matrix SparseMatrixBase<Derived>::asTaucsMatrix()
|
|||||||
res.n = cols();
|
res.n = cols();
|
||||||
res.m = rows();
|
res.m = rows();
|
||||||
res.flags = 0;
|
res.flags = 0;
|
||||||
res.colptr = _outerIndexPtr();
|
res.colptr = derived()._outerIndexPtr();
|
||||||
res.rowind = _innerIndexPtr();
|
res.rowind = derived()._innerIndexPtr();
|
||||||
res.values.v = _valuePtr();
|
res.values.v = derived()._valuePtr();
|
||||||
if (ei_is_same_type<Scalar,int>::ret)
|
if (ei_is_same_type<Scalar,int>::ret)
|
||||||
res.flags |= TAUCS_INT;
|
res.flags |= TAUCS_INT;
|
||||||
else if (ei_is_same_type<Scalar,float>::ret)
|
else if (ei_is_same_type<Scalar,float>::ret)
|
||||||
@ -129,7 +129,7 @@ void SparseLLT<MatrixType,Taucs>::compute(const MatrixType& a)
|
|||||||
{
|
{
|
||||||
taucs_ccs_matrix taucsMatA = const_cast<MatrixType&>(a).asTaucsMatrix();
|
taucs_ccs_matrix taucsMatA = const_cast<MatrixType&>(a).asTaucsMatrix();
|
||||||
taucs_ccs_matrix* taucsRes = taucs_ccs_factor_llt(&taucsMatA, Base::m_precision, 0);
|
taucs_ccs_matrix* taucsRes = taucs_ccs_factor_llt(&taucsMatA, Base::m_precision, 0);
|
||||||
m_matrix = Base::CholMatrixType::Map(*taucsRes);
|
m_matrix = MappedSparseMatrix(*taucsRes);
|
||||||
free(taucsRes);
|
free(taucsRes);
|
||||||
m_status = (m_status & ~(CompleteFactorization|MatrixLIsDirty))
|
m_status = (m_status & ~(CompleteFactorization|MatrixLIsDirty))
|
||||||
| IncompleteFactorization
|
| IncompleteFactorization
|
||||||
@ -161,7 +161,7 @@ SparseLLT<MatrixType,Taucs>::matrixL() const
|
|||||||
ei_assert(!(m_status & SupernodalFactorIsDirty));
|
ei_assert(!(m_status & SupernodalFactorIsDirty));
|
||||||
|
|
||||||
taucs_ccs_matrix* taucsL = taucs_supernodal_factor_to_ccs(m_taucsSupernodalFactor);
|
taucs_ccs_matrix* taucsL = taucs_supernodal_factor_to_ccs(m_taucsSupernodalFactor);
|
||||||
const_cast<typename Base::CholMatrixType&>(m_matrix) = Base::CholMatrixType::Map(*taucsL);
|
const_cast<typename Base::CholMatrixType&>(m_matrix) = MappedSparseMatrix(*taucsL);
|
||||||
free(taucsL);
|
free(taucsL);
|
||||||
m_status = (m_status & ~MatrixLIsDirty);
|
m_status = (m_status & ~MatrixLIsDirty);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user