diff options
author | Desire NUENTSA <desire.nuentsa_wakam@inria.fr> | 2013-06-11 14:42:29 +0200 |
---|---|---|
committer | Desire NUENTSA <desire.nuentsa_wakam@inria.fr> | 2013-06-11 14:42:29 +0200 |
commit | 4cd8245c968577bc94d4cf149e386a597ac7079f (patch) | |
tree | 0b9080d1e3ff06509f6ff8b026dcb14baa15f8c5 /test/sparse_basic.cpp | |
parent | b3fff170a01433f64fa0c6e38a368f375183d28c (diff) |
Add support with unit test for off-diagonal sparse matrix views
Diffstat (limited to 'test/sparse_basic.cpp')
-rw-r--r-- | test/sparse_basic.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp index 121cc05b1..2f92f1627 100644 --- a/test/sparse_basic.cpp +++ b/test/sparse_basic.cpp @@ -3,6 +3,7 @@ // // Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud@inria.fr> // Copyright (C) 2008 Daniel Gomez Ferro <dgomezferro@gmail.com> +// Copyright (C) 2013 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr> // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed @@ -391,6 +392,14 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re refMat3 = refMat2.template triangularView<UnitLower>(); m3 = m2.template triangularView<UnitLower>(); VERIFY_IS_APPROX(m3, refMat3); + + refMat3 = refMat2.template triangularView<StrictlyUpper>(); + m3 = m2.template triangularView<StrictlyUpper>(); + VERIFY_IS_APPROX(m3, refMat3); + + refMat3 = refMat2.template triangularView<StrictlyLower>(); + m3 = m2.template triangularView<StrictlyLower>(); + VERIFY_IS_APPROX(m3, refMat3); } // test selfadjointView @@ -454,6 +463,14 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re } } + + // test Identity matrix + { + DenseMatrix refMat1 = DenseMatrix::Identity(rows, rows); + SparseMatrixType m1(rows, rows); + m1.setIdentity(); + VERIFY_IS_APPROX(m1, refMat1); + } } void test_sparse_basic() |