aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-04-03 08:30:15 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-04-03 08:30:15 +0000
commitff3a3209ca51e03d9471524dd06e13356c2d31bd (patch)
treea67e0a15f6e1916919a1473e0ac65d7155f6a267
parentadf5104bae72ffcdbe9095eb0fdd1f3c2fadac15 (diff)
add an assertion in sparse LLT for invalid input matrix
-rw-r--r--Eigen/src/Sparse/SparseLLT.h8
1 files 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<MatrixType,Backend>::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<MatrixType, Backend>::solveInPlace(MatrixBase<Derived> &b) const
const int size = m_matrix.rows();
ei_assert(size==b.rows());
- m_matrix.solveTriangularInPlace(b);
+ m_matrix.template triangular<LowerTriangular>.solveInPlace(b);
// FIXME should be simply .adjoint() but it fails to compile...
if (NumTraits<Scalar>::IsComplex)
{
CholMatrixType aux = m_matrix.conjugate();
- aux.transpose().solveTriangularInPlace(b);
+ aux.transpose().template triangular<UpperTriangular>.solveInPlace(b);
}
else
- m_matrix.transpose().solveTriangularInPlace(b);
+ m_matrix.transpose().template triangular<UpperTriangular>.solveInPlace(b);
return true;
}