diff options
author | Gael Guennebaud <g.gael@free.fr> | 2010-07-16 14:02:20 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2010-07-16 14:02:20 +0200 |
commit | 044424b0e2d27a33c985803ed3e736e9af28993d (patch) | |
tree | 9105774e3f3f834b66a056e4a77ee321d27b207b /test/array_for_matrix.cpp | |
parent | 6a370f50c72a320a4a5a2740e881b61601d2a917 (diff) |
fix sum()/prod() on empty matrix making sure this does not affect fixed sized object, extend related unit tests including partial reduction
Diffstat (limited to 'test/array_for_matrix.cpp')
-rw-r--r-- | test/array_for_matrix.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/array_for_matrix.cpp b/test/array_for_matrix.cpp index 01e31d05b..3699b861a 100644 --- a/test/array_for_matrix.cpp +++ b/test/array_for_matrix.cpp @@ -72,6 +72,10 @@ template<typename MatrixType> void array_for_matrix(const MatrixType& m) VERIFY_IS_APPROX(m3.rowwise() += rv1, m1.rowwise() + rv1); m3 = m1; VERIFY_IS_APPROX(m3.rowwise() -= rv1, m1.rowwise() - rv1); + + // empty objects + VERIFY_IS_APPROX(m1.block(0,0,0,cols).colwise().sum(), RowVectorType::Zero(cols)); + VERIFY_IS_APPROX(m1.block(0,0,rows,0).rowwise().prod(), ColVectorType::Ones(rows)); } template<typename MatrixType> void comparisons(const MatrixType& m) |