aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/product.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-07-07 11:39:19 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-07-07 11:39:19 +0200
commit92a35c93b2b53694f77993142ce8fcad70bc5519 (patch)
tree38217646f9cc4720112f09d29eed613bf38fa9df /test/product.h
parent544888e342bb7d75412bf0e17b66a3c6196d24eb (diff)
* extended the cache friendly products to support C = alpha * A * M and C += alpha * A * B
* this allows to optimize xpr like C -= lazy_product, still have to catch "scalar_product_of_lazy_product" * started to support conjugate in cache friendly products (very useful to evaluate A * B.adjoint() without evaluating B.adjoint() into a temporary * compilation fix
Diffstat (limited to 'test/product.h')
-rw-r--r--test/product.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/product.h b/test/product.h
index 0ad198662..d6aa372db 100644
--- a/test/product.h
+++ b/test/product.h
@@ -121,6 +121,19 @@ template<typename MatrixType> void product(const MatrixType& m)
vcres = vc2;
vcres += (m1.transpose() * v1).lazy();
VERIFY_IS_APPROX(vcres, vc2 + m1.transpose() * v1);
+
+ // test optimized operator-= path
+ res = square;
+ res -= (m1 * m2.transpose()).lazy();
+ VERIFY_IS_APPROX(res, square - (m1 * m2.transpose()));
+ if (NumTraits<Scalar>::HasFloatingPoint && std::min(rows,cols)>1)
+ {
+ VERIFY(areNotApprox(res,square - m2 * m1.transpose()));
+ }
+ vcres = vc2;
+ vcres -= (m1.transpose() * v1).lazy();
+ VERIFY_IS_APPROX(vcres, vc2 - m1.transpose() * v1);
+
tm1 = m1;
VERIFY_IS_APPROX(tm1.transpose() * v1, m1.transpose() * v1);
VERIFY_IS_APPROX(v1.transpose() * tm1, v1.transpose() * m1);
@@ -142,4 +155,3 @@ template<typename MatrixType> void product(const MatrixType& m)
VERIFY(areNotApprox(res2,square2 + m2.transpose() * m1));
}
}
-