aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/permutationmatrices.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-11-16 09:39:07 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-11-16 09:39:07 -0500
commitb25eb5fdaade6c20457a411fd08e17acc54f3349 (patch)
tree95ec2374aab55cbb74ee7324913a3c13c045d7d7 /test/permutationmatrices.cpp
parente09768e3bc8ff60972cc7cbf49e4a12e2b1c9235 (diff)
PermutationMatrix: add inverse() and product of permutations
Diffstat (limited to 'test/permutationmatrices.cpp')
-rw-r--r--test/permutationmatrices.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/permutationmatrices.cpp b/test/permutationmatrices.cpp
index 13b01cd83..ec3a8541c 100644
--- a/test/permutationmatrices.cpp
+++ b/test/permutationmatrices.cpp
@@ -72,6 +72,15 @@ template<typename MatrixType> void permutationmatrices(const MatrixType& m)
Matrix<Scalar,Cols,Cols> rm(rp);
VERIFY_IS_APPROX(m_permuted, lm*m_original*rm);
+
+ VERIFY_IS_APPROX(lp.inverse()*m_permuted*rp.inverse(), m_original);
+ VERIFY((lp*lp.inverse()).toDenseMatrix().isIdentity());
+
+ LeftPermutationVectorType lv2;
+ randomPermutationVector(lv2, rows);
+ LeftPermutationType lp2(lv2);
+ Matrix<Scalar,Rows,Rows> lm2(lp2);
+ VERIFY_IS_APPROX((lp*lp2).toDenseMatrix().template cast<Scalar>(), lm2*lm);
}
void test_permutationmatrices()