diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-09-08 10:21:22 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-09-08 10:21:22 +0200 |
commit | 51b3f558bb76c11149fc64971db786798f1b692c (patch) | |
tree | 7e46749eb58cf4660ecde04a5f96afbba92965c7 /test/product.h | |
parent | 6162672dc55dc891a1e2ab1c93d503d7f41cfdac (diff) |
Fix bug #822: outer products needed linear access, and add respective unit tests
Diffstat (limited to 'test/product.h')
-rw-r--r-- | test/product.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/product.h b/test/product.h index 856b234ac..0b3abe402 100644 --- a/test/product.h +++ b/test/product.h @@ -139,4 +139,12 @@ template<typename MatrixType> void product(const MatrixType& m) // inner product Scalar x = square2.row(c) * square2.col(c2); VERIFY_IS_APPROX(x, square2.row(c).transpose().cwiseProduct(square2.col(c2)).sum()); + + // outer product + VERIFY_IS_APPROX(m1.col(c) * m1.row(r), m1.block(0,c,rows,1) * m1.block(r,0,1,cols)); + VERIFY_IS_APPROX(m1.row(r).transpose() * m1.col(c).transpose(), m1.block(r,0,1,cols).transpose() * m1.block(0,c,rows,1).transpose()); + VERIFY_IS_APPROX(m1.block(0,c,rows,1) * m1.row(r), m1.block(0,c,rows,1) * m1.block(r,0,1,cols)); + VERIFY_IS_APPROX(m1.col(c) * m1.block(r,0,1,cols), m1.block(0,c,rows,1) * m1.block(r,0,1,cols)); + VERIFY_IS_APPROX(m1.leftCols(1) * m1.row(r), m1.block(0,0,rows,1) * m1.block(r,0,1,cols)); + VERIFY_IS_APPROX(m1.col(c) * m1.topRows(1), m1.block(0,c,rows,1) * m1.block(0,0,1,cols)); } |