From ff3a3209ca51e03d9471524dd06e13356c2d31bd Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 3 Apr 2009 08:30:15 +0000 Subject: [PATCH] add an assertion in sparse LLT for invalid input matrix --- Eigen/src/Sparse/SparseLLT.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Eigen/src/Sparse/SparseLLT.h b/Eigen/src/Sparse/SparseLLT.h index e7c314c2c..864c4415a 100644 --- a/Eigen/src/Sparse/SparseLLT.h +++ b/Eigen/src/Sparse/SparseLLT.h @@ -147,6 +147,8 @@ void SparseLLT::compute(const MatrixType& a) // init with current matrix a { typename MatrixType::InnerIterator it(a,j); + ei_assert(it.index()==j && + "matrix must has non zero diagonal entries and only the lower triangular part must be stored"); ++it; // skip diagonal element for (; it; ++it) tempVector.coeffRef(it.index()) = it.value(); @@ -189,15 +191,15 @@ bool SparseLLT::solveInPlace(MatrixBase &b) const const int size = m_matrix.rows(); ei_assert(size==b.rows()); - m_matrix.solveTriangularInPlace(b); + m_matrix.template triangular.solveInPlace(b); // FIXME should be simply .adjoint() but it fails to compile... if (NumTraits::IsComplex) { CholMatrixType aux = m_matrix.conjugate(); - aux.transpose().solveTriangularInPlace(b); + aux.transpose().template triangular.solveInPlace(b); } else - m_matrix.transpose().solveTriangularInPlace(b); + m_matrix.transpose().template triangular.solveInPlace(b); return true; }