diff options
author | Gael Guennebaud <g.gael@free.fr> | 2011-12-03 23:49:37 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2011-12-03 23:49:37 +0100 |
commit | 91e392a042ca8d40e460e5cf51d447bcce7a43d4 (patch) | |
tree | 6c38e1b0121cb70976f0cfb96be5e5575d94b9e7 /Eigen/src/SparseCore/TriangularSolver.h | |
parent | a09cc5d4c014e517ef766b3ff0e535ad8d9a6dc9 (diff) |
add ReverseInnerIterators to loop over the elements in reverse order,
and partly fix bug #356 (issue in trisolve for upper-column major))
Diffstat (limited to 'Eigen/src/SparseCore/TriangularSolver.h')
-rw-r--r-- | Eigen/src/SparseCore/TriangularSolver.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Eigen/src/SparseCore/TriangularSolver.h b/Eigen/src/SparseCore/TriangularSolver.h index 6c66052bf..45128afe2 100644 --- a/Eigen/src/SparseCore/TriangularSolver.h +++ b/Eigen/src/SparseCore/TriangularSolver.h @@ -156,9 +156,11 @@ struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,ColMajor> { if(!(Mode & UnitDiag)) { - // FIXME lhs.coeff(i,i) might not be always efficient while it must simply be the - // last element of the column ! - other.coeffRef(i,col) /= lhs.innerVector(i).lastCoeff(); + typename Lhs::ReverseInnerIterator it(lhs, i); + while(it && it.index()!=i) + --it; + eigen_assert(it && it.index()==i); + other.coeffRef(i,col) /= it.value(); } typename Lhs::InnerIterator it(lhs, i); for(; it && it.index()<i; ++it) |