aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2015-04-26 21:05:33 +0200
committerGravatar Christoph Hertzberg <chtz@informatik.uni-bremen.de>2015-04-26 21:05:33 +0200
commitda2baf685df26421e31f780c24936fbd74a767a4 (patch)
tree41c7fe2738438652cdba8b382be73c42fd688ed7 /test
parent8c6a3b5ace495ed836c80e5a6317abf40c521426 (diff)
Regression test for bug #302
(transplanted from 80fd8fab87d7d65cfeb9b1e64d8b42ee4463ab64 ) Changed DenseIndex to Index
Diffstat (limited to 'test')
-rw-r--r--test/lu.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/lu.cpp b/test/lu.cpp
index 25f86755a..b90367438 100644
--- a/test/lu.cpp
+++ b/test/lu.cpp
@@ -100,7 +100,9 @@ template<typename MatrixType> void lu_invertible()
LU.h
*/
typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;
- int size = internal::random<int>(1,EIGEN_TEST_MAX_SIZE);
+ Index size = MatrixType::RowsAtCompileTime;
+ if( size==Dynamic)
+ size = internal::random<Index>(1,EIGEN_TEST_MAX_SIZE);
MatrixType m1(size, size), m2(size, size), m3(size, size);
FullPivLU<MatrixType> lu;
@@ -122,6 +124,10 @@ template<typename MatrixType> void lu_invertible()
m2 = lu.solve(m3);
VERIFY_IS_APPROX(m3, m1*m2);
VERIFY_IS_APPROX(m2, lu.inverse()*m3);
+
+ // Regression test for Bug 302
+ MatrixType m4 = MatrixType::Random(size,size);
+ VERIFY_IS_APPROX(lu.solve(m3*m4), lu.solve(m3)*m4);
}
template<typename MatrixType> void lu_partial_piv()
@@ -171,6 +177,7 @@ void test_lu()
{
for(int i = 0; i < g_repeat; i++) {
CALL_SUBTEST_1( lu_non_invertible<Matrix3f>() );
+ CALL_SUBTEST_1( lu_invertible<Matrix3f>() );
CALL_SUBTEST_1( lu_verify_assert<Matrix3f>() );
CALL_SUBTEST_2( (lu_non_invertible<Matrix<double, 4, 6> >()) );