Fix sparse triangular view iterator

This commit is contained in:
Charles Schlosser 2023-10-05 17:13:37 +00:00 committed by Antonio Sánchez
parent 6d829e766f
commit e8515f78ac
2 changed files with 7 additions and 2 deletions

View File

@ -152,8 +152,8 @@ public:
}
}
// inline Index row() const { return (ArgType::Flags&RowMajorBit ? Base::outer() : this->index()); }
// inline Index col() const { return (ArgType::Flags&RowMajorBit ? this->index() : Base::outer()); }
inline Index row() const { return (ArgType::Flags&RowMajorBit ? Base::outer() : this->index()); }
inline Index col() const { return (ArgType::Flags&RowMajorBit ? this->index() : Base::outer()); }
inline StorageIndex index() const
{
if(HasUnitDiag && m_returnOne) return internal::convert_index<StorageIndex>(Base::outer());

View File

@ -746,6 +746,11 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
// check sparse-triangular to dense
refMat3 = m2.template triangularView<StrictlyUpper>();
VERIFY_IS_APPROX(refMat3, DenseMatrix(refMat2.template triangularView<StrictlyUpper>()));
// check sparse triangular view iteration-based evaluation
m2.setZero();
VERIFY_IS_CWISE_EQUAL(m2.template triangularView<UnitLower>().toDense(), DenseMatrix::Identity(rows, cols));
VERIFY_IS_CWISE_EQUAL(m2.template triangularView<UnitUpper>().toDense(), DenseMatrix::Identity(rows, cols));
}
// test selfadjointView