From 044424b0e2d27a33c985803ed3e736e9af28993d Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 16 Jul 2010 14:02:20 +0200 Subject: fix sum()/prod() on empty matrix making sure this does not affect fixed sized object, extend related unit tests including partial reduction --- test/array_for_matrix.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/array_for_matrix.cpp') 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 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 void comparisons(const MatrixType& m) -- cgit v1.2.3