Skip to content

Commit 801b43c

Browse files
committed
Add a 4x4 permutation matrix as an inv() test
1 parent 045c1cf commit 801b43c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/inv.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ end
4747
sm = SMatrix{4,4}(m)
4848
@test isapprox(inv(sm)::StaticMatrix, inv(m), rtol=2e-15)
4949

50+
# A permutation matrix which can cause problems for inversion methods
51+
# without pivoting, eg 2x2 block decomposition (see #250)
52+
mperm = [1 0 0 0;
53+
0 0 1 0;
54+
0 1 0 0;
55+
0 0 0 1]
56+
@test inv(SMatrix{4,4}(mperm))::StaticMatrix inv(mperm) rtol=2e-16
57+
5058
# Poorly conditioned matrix; almost_singular_matrix(4, 3, 1e-7)
5159
m = [
5260
2.83056817904263402e-01 1.26822318692296848e-01 2.59665505365002547e-01 1.24524798964590747e-01

0 commit comments

Comments
 (0)