diff options
author | Gael Guennebaud <g.gael@free.fr> | 2010-06-02 09:45:57 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2010-06-02 09:45:57 +0200 |
commit | 4ebb80490ab24c41e066c6a3082b29777adbb6e5 (patch) | |
tree | 5f645620b51f4c52a6a1ba20913040a941f2371d /test/product.h | |
parent | 314bfa13753f153d44ff76a1c8ce0206616b06d9 (diff) |
implicit conversion to scalar for inner product
Diffstat (limited to 'test/product.h')
-rw-r--r-- | test/product.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/product.h b/test/product.h index 277b73c45..71dc4bde2 100644 --- a/test/product.h +++ b/test/product.h @@ -71,8 +71,9 @@ template<typename MatrixType> void product(const MatrixType& m) Scalar s1 = ei_random<Scalar>(); - int r = ei_random<int>(0, rows-1), - c = ei_random<int>(0, cols-1); + int r = ei_random<int>(0, rows-1), + c = ei_random<int>(0, cols-1), + c2 = ei_random<int>(0, cols-1); // begin testing Product.h: only associativity for now // (we use Transpose.h but this doesn't count as a test for it) @@ -150,4 +151,8 @@ template<typename MatrixType> void product(const MatrixType& m) { VERIFY(areNotApprox(res2,square2 + m2.transpose() * m1)); } + + // inner product + Scalar x = square2.row(c) * square2.col(c2); + VERIFY_IS_APPROX(x, square2.row(c).transpose().cwiseProduct(square2.col(c2)).sum()); } |