Skip to content

Commit c0cfcf5

Browse files
committed
Better linalg tests
1 parent 87cd5cf commit c0cfcf5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

test/operation_overloads.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ using LinearAlgebra
33
using SparseArrays: sparse
44
using Test
55

6-
@variables a,b,c,d
6+
@variables a,b,c,d,e,f,g,h,i
77

88
# test hashing
99
aa = a; # old a
@@ -18,9 +18,13 @@ aa = a; # old a
1818
@test hash(a+b ~ c+d) == hash(a+b ~ c+d)
1919

2020
# test some matrix operations don't throw errors
21-
X = [a b;c d]
22-
det(X)
23-
lu(X)
21+
X = [0 b c; d e f; g h i]
22+
@test iszero(simplify(det(X) - ((b * f * g) + (c * d * h) - (b * d * i) - (c * e * g)), polynorm=true))
23+
F = lu(X)
24+
R = simplify.(F.L * F.U - X[F.p, :], polynorm=true)
25+
@test iszero(R)
26+
@test simplify.(F \ X, polynorm=true) == I
27+
@test ModelingToolkit._solve(X, X) == I
2428
inv(X)
2529
qr(X)
2630

0 commit comments

Comments
 (0)