aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/redux.cpp
diff options
context:
space:
mode:
authorGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-01-29 12:12:02 +0100
committerGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-01-29 12:12:02 +0100
commit6dee5440e4971781077769913586e9748b1d6dbf (patch)
tree06641abffa1adb278a3bf78c8d1c067e84666863 /test/redux.cpp
parent42b88983ff846624ff335e2a60f7435acb7cb9cf (diff)
Adapted mean to work with complex numbers.
Added regression test.
Diffstat (limited to 'test/redux.cpp')
-rw-r--r--test/redux.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/redux.cpp b/test/redux.cpp
index 3293fd54e..f95e8b29c 100644
--- a/test/redux.cpp
+++ b/test/redux.cpp
@@ -44,7 +44,11 @@ template<typename MatrixType> void matrixRedux(const MatrixType& m)
minc = std::min(ei_real(minc), ei_real(m1(i,j)));
maxc = std::max(ei_real(maxc), ei_real(m1(i,j)));
}
+ const Scalar mean = s/Scalar(rows*cols);
+ const Scalar other_mean = m1.mean();
+
VERIFY_IS_APPROX(m1.sum(), s);
+ VERIFY_IS_APPROX(m1.mean(), mean);
VERIFY_IS_APPROX(m1.prod(), p);
VERIFY_IS_APPROX(m1.real().minCoeff(), ei_real(minc));
VERIFY_IS_APPROX(m1.real().maxCoeff(), ei_real(maxc));
@@ -113,15 +117,24 @@ void test_redux()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( matrixRedux(Matrix<float, 1, 1>()) );
+ CALL_SUBTEST_1( matrixRedux(Array<float, 1, 1>()) );
CALL_SUBTEST_2( matrixRedux(Matrix2f()) );
+ CALL_SUBTEST_2( matrixRedux(Array2f()) );
CALL_SUBTEST_3( matrixRedux(Matrix4d()) );
+ CALL_SUBTEST_3( matrixRedux(Array4d()) );
CALL_SUBTEST_4( matrixRedux(MatrixXcf(3, 3)) );
+ CALL_SUBTEST_4( matrixRedux(ArrayXXcf(3, 3)) );
CALL_SUBTEST_5( matrixRedux(MatrixXd(8, 12)) );
+ CALL_SUBTEST_5( matrixRedux(ArrayXXd(8, 12)) );
CALL_SUBTEST_6( matrixRedux(MatrixXi(8, 12)) );
+ CALL_SUBTEST_6( matrixRedux(ArrayXXi(8, 12)) );
}
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_7( vectorRedux(Vector4f()) );
+ CALL_SUBTEST_7( vectorRedux(Array4f()) );
CALL_SUBTEST_5( vectorRedux(VectorXd(10)) );
+ CALL_SUBTEST_5( vectorRedux(ArrayXd(10)) );
CALL_SUBTEST_8( vectorRedux(VectorXf(33)) );
+ CALL_SUBTEST_8( vectorRedux(ArrayXf(33)) );
}
}