aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-09-06 11:51:42 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-09-06 11:51:42 +0200
commit9bb75937cc698b32f2fe6ffac3b4e09a89c3c5f7 (patch)
tree99d99731ff24bf0599b69d869107821cf7cee55c /test
parent62eb4dc99bb79a0e2015548c248d6270928533f1 (diff)
fix += return by value like operations
Diffstat (limited to 'test')
-rw-r--r--test/cholesky.cpp15
-rw-r--r--test/linearstructure.cpp2
2 files changed, 16 insertions, 1 deletions
diff --git a/test/cholesky.cpp b/test/cholesky.cpp
index 0edf9a793..46140bb11 100644
--- a/test/cholesky.cpp
+++ b/test/cholesky.cpp
@@ -168,6 +168,21 @@ template<typename MatrixType> void cholesky(const MatrixType& m)
}
}
+ // test some special use cases of SelfCwiseBinaryOp:
+ MatrixType m1 = MatrixType::Random(rows,cols), m2(rows,cols);
+ m2 = m1;
+ m2 += symmLo.template selfadjointView<Lower>().llt().solve(matB);
+ VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView<Lower>().llt().solve(matB));
+ m2 = m1;
+ m2 -= symmLo.template selfadjointView<Lower>().llt().solve(matB);
+ VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView<Lower>().llt().solve(matB));
+ m2 = m1;
+ m2.noalias() += symmLo.template selfadjointView<Lower>().llt().solve(matB);
+ VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView<Lower>().llt().solve(matB));
+ m2 = m1;
+ m2.noalias() -= symmLo.template selfadjointView<Lower>().llt().solve(matB);
+ VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView<Lower>().llt().solve(matB));
+
}
template<typename MatrixType> void cholesky_cplx(const MatrixType& m)
diff --git a/test/linearstructure.cpp b/test/linearstructure.cpp
index a0b8982dd..b5c58bdaa 100644
--- a/test/linearstructure.cpp
+++ b/test/linearstructure.cpp
@@ -27,7 +27,7 @@
template<typename MatrixType> void linearStructure(const MatrixType& m)
{
/* this test covers the following files:
- Sum.h Difference.h Opposite.h ScalarMultiple.h
+ CwiseUnaryOp.h, CwiseBinaryOp.h, SelfCwiseBinaryOp.h
*/
typedef typename MatrixType::Index Index;
typedef typename MatrixType::Scalar Scalar;