diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-10-28 12:53:13 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-10-28 12:53:13 +0100 |
commit | 1f11dd6cedc223f92f9ce99a22080dd267fcb488 (patch) | |
tree | 9b867c99dea90cfdcd979eafee13558f6792d107 /test | |
parent | 902c2db5a5cc4e8e33f15a37da13992116402c30 (diff) |
Add a unit test for large chains of products
Diffstat (limited to 'test')
-rw-r--r-- | test/product_large.cpp | 11 | ||||
-rw-r--r-- | test/product_small.cpp | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/test/product_large.cpp b/test/product_large.cpp index 84c489580..7207973c2 100644 --- a/test/product_large.cpp +++ b/test/product_large.cpp @@ -61,6 +61,17 @@ void test_product_large() MatrixXf r2 = mat1.row(2)*mat2; VERIFY_IS_APPROX(r2, (mat1.row(2)*mat2).eval()); } + + { + Eigen::MatrixXd A(10,10), B, C; + A.setRandom(); + C = A; + for(int k=0; k<79; ++k) + C = C * A; + B.noalias() = (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))) + * (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))); + VERIFY_IS_APPROX(B,C); + } #endif // Regression test for bug 714: diff --git a/test/product_small.cpp b/test/product_small.cpp index 091955a0f..c561ec63b 100644 --- a/test/product_small.cpp +++ b/test/product_small.cpp @@ -56,5 +56,16 @@ void test_product_small() VERIFY_IS_APPROX(B * A.inverse(), B * A.inverse()[0]); VERIFY_IS_APPROX(A.inverse() * C, A.inverse()[0] * C); } + + { + Eigen::Matrix<double, 100, 100> A, B, C; + A.setRandom(); + C = A; + for(int k=0; k<79; ++k) + C = C * A; + B.noalias() = (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))) + * (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))); + VERIFY_IS_APPROX(B,C); + } #endif } |