Fix SparseLU::absDeterminant and add respective unit test

This commit is contained in:
Gael Guennebaud
2014-10-17 16:52:56 +02:00
parent a13bc22204
commit a370b1f2e2
4 changed files with 40 additions and 5 deletions

View File

@@ -249,14 +249,13 @@ class SparseLU : public SparseSolverBase<SparseLU<_MatrixType,_OrderingType> >,
eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
// Initialize with the determinant of the row matrix
Scalar det = Scalar(1.);
//Note that the diagonal blocks of U are stored in supernodes,
// Note that the diagonal blocks of U are stored in supernodes,
// which are available in the L part :)
for (Index j = 0; j < this->cols(); ++j)
{
for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
{
if(it.row() < j) continue;
if(it.row() == j)
if(it.index() == j)
{
det *= abs(it.value());
break;