mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
* add cmake files to find (optional) supported libraries
* add unit tests for sparse cholesky
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user