summaryrefslogtreecommitdiffhomepage
path: root/eigen/test/selfadjoint.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'eigen/test/selfadjoint.cpp')
-rw-r--r--eigen/test/selfadjoint.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/eigen/test/selfadjoint.cpp b/eigen/test/selfadjoint.cpp
index 76dab6d..92401e5 100644
--- a/eigen/test/selfadjoint.cpp
+++ b/eigen/test/selfadjoint.cpp
@@ -21,7 +21,9 @@ template<typename MatrixType> void selfadjoint(const MatrixType& m)
Index cols = m.cols();
MatrixType m1 = MatrixType::Random(rows, cols),
- m3(rows, cols);
+ m2 = MatrixType::Random(rows, cols),
+ m3(rows, cols),
+ m4(rows, cols);
m1.diagonal() = m1.diagonal().real().template cast<Scalar>();
@@ -30,10 +32,19 @@ template<typename MatrixType> void selfadjoint(const MatrixType& m)
VERIFY_IS_APPROX(MatrixType(m3.template triangularView<Upper>()), MatrixType(m1.template triangularView<Upper>()));
VERIFY_IS_APPROX(m3, m3.adjoint());
-
m3 = m1.template selfadjointView<Lower>();
VERIFY_IS_APPROX(MatrixType(m3.template triangularView<Lower>()), MatrixType(m1.template triangularView<Lower>()));
VERIFY_IS_APPROX(m3, m3.adjoint());
+
+ m3 = m1.template selfadjointView<Upper>();
+ m4 = m2;
+ m4 += m1.template selfadjointView<Upper>();
+ VERIFY_IS_APPROX(m4, m2+m3);
+
+ m3 = m1.template selfadjointView<Lower>();
+ m4 = m2;
+ m4 -= m1.template selfadjointView<Lower>();
+ VERIFY_IS_APPROX(m4, m2-m3);
}
void bug_159()