mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
fix bug #294: add a diagonal() method to SparseMatrix (const)
This commit is contained in:
@@ -345,6 +345,14 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
|
||||
initSparse<Scalar>(density, refMat2, m2);
|
||||
VERIFY_IS_APPROX(m2.eval(), refMat2.sparseView().eval());
|
||||
}
|
||||
|
||||
// test diagonal
|
||||
{
|
||||
DenseMatrix refMat2 = DenseMatrix::Zero(rows, rows);
|
||||
SparseMatrixType m2(rows, rows);
|
||||
initSparse<Scalar>(density, refMat2, m2);
|
||||
VERIFY_IS_APPROX(m2.diagonal(), refMat2.diagonal().eval());
|
||||
}
|
||||
}
|
||||
|
||||
void test_sparse_basic()
|
||||
|
||||
Reference in New Issue
Block a user