aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/product_extra.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-03-31 15:19:57 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-03-31 15:19:57 +0200
commitae01c05e184c62601521e785f733daf4a425b1c0 (patch)
tree39178f3208059214aa65823c0e13960de9b3f620 /test/product_extra.cpp
parentbd76d837e6eeaf82dd7db30435d49e939b4674af (diff)
Fix computeProductBlockingSizes with m==0, and add respective unit test.
Diffstat (limited to 'test/product_extra.cpp')
-rw-r--r--test/product_extra.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/test/product_extra.cpp b/test/product_extra.cpp
index 1b4c6c33c..67ea13568 100644
--- a/test/product_extra.cpp
+++ b/test/product_extra.cpp
@@ -134,7 +134,7 @@ void zero_sized_objects(const MatrixType& m)
}
}
-
+template<int>
void bug_127()
{
// Bug 127
@@ -159,6 +159,7 @@ void bug_127()
a*b;
}
+template<int>
void unaligned_objects()
{
// Regression test for the bug reported here:
@@ -188,6 +189,29 @@ void unaligned_objects()
}
}
+template<typename T>
+EIGEN_DONT_INLINE
+Index test_compute_block_size(Index m, Index n, Index k)
+{
+ Index mc(m), nc(n), kc(k);
+ internal::computeProductBlockingSizes<T,T>(kc, mc, nc);
+ return kc+mc+nc;
+}
+
+template<typename T>
+Index compute_block_size()
+{
+ Index ret = 0;
+ ret += test_compute_block_size<T>(0,1,1);
+ ret += test_compute_block_size<T>(1,0,1);
+ ret += test_compute_block_size<T>(1,1,0);
+ ret += test_compute_block_size<T>(0,0,1);
+ ret += test_compute_block_size<T>(0,1,0);
+ ret += test_compute_block_size<T>(1,0,0);
+ ret += test_compute_block_size<T>(0,0,0);
+ return ret;
+}
+
void test_product_extra()
{
for(int i = 0; i < g_repeat; i++) {
@@ -198,6 +222,9 @@ void test_product_extra()
CALL_SUBTEST_4( product_extra(MatrixXcd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2), internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))) );
CALL_SUBTEST_1( zero_sized_objects(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );
}
- CALL_SUBTEST_5( bug_127() );
- CALL_SUBTEST_6( unaligned_objects() );
+ CALL_SUBTEST_5( bug_127<0>() );
+ CALL_SUBTEST_6( unaligned_objects<0>() );
+ CALL_SUBTEST_7( compute_block_size<float>() );
+ CALL_SUBTEST_7( compute_block_size<double>() );
+ CALL_SUBTEST_7( compute_block_size<std::complex<double> >() );
}