* add cmake files to find (optional) supported libraries

* add unit tests for sparse cholesky
This commit is contained in:
Gael Guennebaud
2008-10-20 10:43:11 +00:00
parent f44316e5f8
commit fa27cd1ed0
10 changed files with 331 additions and 97 deletions

View File

@@ -195,11 +195,12 @@ template<typename MatrixType>
template<typename Derived>
void SparseLLT<MatrixType,Cholmod>::solveInPlace(MatrixBase<Derived> &b) const
{
if (m_status & MatrixLIsDirty)
matrixL();
const int size = m_matrix.rows();
ei_assert(size==b.rows());
if (m_status & MatrixLIsDirty)
matrixL();
Base::solveInPlace(b);
}

View File

@@ -139,7 +139,6 @@ void SparseLLT<MatrixType,Backend>::compute(const MatrixType& a)
for (int j = 0; j < size; ++j)
{
Scalar x = ei_real(a.coeff(j,j));
int endSize = size-j-1;
// TODO better estimate of the density !
tempVector.init(density>0.001? IsDense : IsSparse);
@@ -191,7 +190,8 @@ bool SparseLLT<MatrixType, Backend>::solveInPlace(MatrixBase<Derived> &b) const
ei_assert(size==b.rows());
m_matrix.solveTriangularInPlace(b);
m_matrix.adjoint().solveTriangularInPlace(b);
// FIXME should be .adjoint() but it fails to compile...
m_matrix.transpose().solveTriangularInPlace(b);
return true;
}

View File

@@ -151,7 +151,7 @@ void SparseLLT<MatrixType,Taucs>::compute(const MatrixType& a)
else
{
// use the faster Multifrontal routine
m_taucsSupernodalFactor = taucs_ccs_factor_llt_ll(&taucsMatA);
m_taucsSupernodalFactor = taucs_ccs_factor_llt_mf(&taucsMatA);
}
m_status = (m_status & ~IncompleteFactorization) | CompleteFactorization | MatrixLIsDirty;
}
@@ -177,16 +177,19 @@ template<typename MatrixType>
template<typename Derived>
void SparseLLT<MatrixType,Taucs>::solveInPlace(MatrixBase<Derived> &b) const
{
const int size = m_matrix.rows();
ei_assert(size==b.rows());
if (m_status & MatrixLIsDirty)
{
// ei_assert(!(m_status & SupernodalFactorIsDirty));
// taucs_supernodal_solve_llt(m_taucsSupernodalFactor,double* b);
//matrixL();
// TODO use taucs's supernodal solver, in particular check types, storage order, etc.
// VectorXb x(b.rows());
// for (int j=0; j<b.cols(); ++j)
// {
// taucs_supernodal_solve_llt(m_taucsSupernodalFactor,x.data(),&b.col(j).coeffRef(0));
// b.col(j) = x;
// }
matrixL();
}
else
{
Base::solveInPlace(b);
}