mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
improve aliasing detection for inverse and add unit test
This commit is contained in:
@@ -82,6 +82,19 @@ template<typename MatrixType> void inverse(const MatrixType& m)
|
||||
m3.computeInverseWithCheck(m4, invertible);
|
||||
VERIFY( rows==1 ? invertible : !invertible );
|
||||
#endif
|
||||
|
||||
// check in-place inversion
|
||||
if(MatrixType::RowsAtCompileTime>=2 && MatrixType::RowsAtCompileTime<=4)
|
||||
{
|
||||
// in-place is forbidden
|
||||
VERIFY_RAISES_ASSERT(m1 = m1.inverse());
|
||||
}
|
||||
else
|
||||
{
|
||||
m2 = m1.inverse();
|
||||
m1 = m1.inverse();
|
||||
VERIFY_IS_APPROX(m1,m2);
|
||||
}
|
||||
}
|
||||
|
||||
void test_inverse()
|
||||
|
||||
Reference in New Issue
Block a user