aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sparse_basic.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2011-12-04 21:49:21 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2011-12-04 21:49:21 +0100
commit82f9aa194d0b516b3041e04fde808c3404ba0473 (patch)
tree01c8162f82a5777dbcf705f9955082d4b67c7176 /test/sparse_basic.cpp
parent69966e90e12c0c9eef4f370945e23fcc943ee8a6 (diff)
fix bug #294: add a diagonal() method to SparseMatrix (const)
Diffstat (limited to 'test/sparse_basic.cpp')
-rw-r--r--test/sparse_basic.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp
index 3a9cb61b3..276db65aa 100644
--- a/test/sparse_basic.cpp
+++ b/test/sparse_basic.cpp
@@ -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()