diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-08-11 15:15:06 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-08-11 15:15:06 +0200 |
commit | afbd73b5cdc1ce9b8ae54e9dd08332c870cf54d2 (patch) | |
tree | 1a7803061dfd11097b94f1e1a54d374d254c3867 /test | |
parent | a4f664251863907604d43be70a41cc4c1dddd42a (diff) |
overload operartor* with a ProductBase such that "scalar * (mat * mat)" is optimized
as one could naturally expect
Diffstat (limited to 'test')
-rw-r--r-- | test/product_notemporary.cpp | 2 | ||||
-rw-r--r-- | test/product_symm.cpp | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/test/product_notemporary.cpp b/test/product_notemporary.cpp index f4311e495..d5d996e49 100644 --- a/test/product_notemporary.cpp +++ b/test/product_notemporary.cpp @@ -79,7 +79,7 @@ template<typename MatrixType> void product_notemporary(const MatrixType& m) VERIFY_EVALUATION_COUNT( m3 = (s1 * m1 * s2 * (m1*s3+m2*s2).adjoint()).lazy(), 1); VERIFY_EVALUATION_COUNT( m3 = ((s1 * m1).adjoint() * s2 * m2).lazy(), 0); VERIFY_EVALUATION_COUNT( m3 -= (s1 * (-m1*s3).adjoint() * (s2 * m2 * s3)).lazy(), 0); - VERIFY_EVALUATION_COUNT( m3 -= (s1 * (m1.transpose() * m2)).lazy(), 1); + VERIFY_EVALUATION_COUNT( m3 -= (s1 * (m1.transpose() * m2)).lazy(), 0); VERIFY_EVALUATION_COUNT(( m3.block(r0,r0,r1,r1) += (-m1.block(r0,c0,r1,c1) * (s2*m2.block(r0,c0,r1,c1)).adjoint()).lazy() ), 0); VERIFY_EVALUATION_COUNT(( m3.block(r0,r0,r1,r1) -= (s1 * m1.block(r0,c0,r1,c1) * m2.block(c0,r0,c1,r1)).lazy() ), 0); diff --git a/test/product_symm.cpp b/test/product_symm.cpp index 88bac878b..1300928a2 100644 --- a/test/product_symm.cpp +++ b/test/product_symm.cpp @@ -94,6 +94,11 @@ template<typename Scalar, int Size, int OtherSize> void symm(int size = Size, in VERIFY_IS_APPROX(rhs12 = (s1*m2.adjoint()).template selfadjointView<LowerTriangular>() * (s2*rhs3).conjugate(), rhs13 = (s1*m1.adjoint()) * (s2*rhs3).conjugate()); + + m2 = m1.template triangularView<UpperTriangular>(); rhs13 = rhs12; + VERIFY_IS_APPROX(rhs12 += (s1 * ((m2.adjoint()).template selfadjointView<LowerTriangular>() * (s2*rhs3).conjugate())).lazy(), + rhs13 += (s1*m1.adjoint()) * (s2*rhs3).conjugate()); + // test matrix * selfadjoint symm_extra<OtherSize>::run(m1,m2,rhs2,rhs22,rhs23,s1,s2); |