diff options
author | Gael Guennebaud <g.gael@free.fr> | 2019-01-29 10:27:13 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2019-01-29 10:27:13 +0100 |
commit | 8a06c699d0f8d47f4fc4f259a21574b4719792b2 (patch) | |
tree | 9a688002fe4f7daf611bde54e850f75918e672df /test/inverse.cpp | |
parent | a2a07e62b951e6b2c8cb0e8283849c0ef54a5f72 (diff) |
bug #1669: fix PartialPivLU/inverse with zero-sized matrices.
Diffstat (limited to 'test/inverse.cpp')
-rw-r--r-- | test/inverse.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/inverse.cpp b/test/inverse.cpp index 8754cb7e5..99f9e0c9b 100644 --- a/test/inverse.cpp +++ b/test/inverse.cpp @@ -105,6 +105,22 @@ template<typename MatrixType> void inverse(const MatrixType& m) } } +template<typename Scalar> +void inverse_zerosized() +{ + Matrix<Scalar,Dynamic,Dynamic> A(0,0); + { + Matrix<Scalar,0,1> b, x; + x = A.inverse() * b; + } + { + Matrix<Scalar,Dynamic,Dynamic> b(0,1), x; + x = A.inverse() * b; + VERIFY_IS_EQUAL(x.rows(), 0); + VERIFY_IS_EQUAL(x.cols(), 1); + } +} + EIGEN_DECLARE_TEST(inverse) { int s = 0; @@ -118,6 +134,7 @@ EIGEN_DECLARE_TEST(inverse) s = internal::random<int>(50,320); CALL_SUBTEST_5( inverse(MatrixXf(s,s)) ); TEST_SET_BUT_UNUSED_VARIABLE(s) + CALL_SUBTEST_5( inverse_zerosized<float>() ); s = internal::random<int>(25,100); CALL_SUBTEST_6( inverse(MatrixXcd(s,s)) ); |