Skip to content

Commit f746211

Browse files
committed
Cleanup tests
1 parent c37be94 commit f746211

File tree

1 file changed

+19
-21
lines changed

1 file changed

+19
-21
lines changed

test/solve.jl

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,25 @@ end
2828

2929
@testset "Solving triangular system" begin
3030
for n in (1, 2, 3, 4),
31-
(t, uplo) in ((UpperTriangular, :U),
32-
(LowerTriangular, :L)),
33-
(m, v, u) in ((SMatrix{n,n}, SVector{n}, SMatrix{n, 2}),
34-
(MMatrix{n,n}, MVector{n}, SMatrix{n, 2})),
35-
eltya in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloat}, Int),
36-
eltyb in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloat})
31+
(t, uplo) in ((UpperTriangular, :U),
32+
(LowerTriangular, :L)),
33+
(m, v, u) in ((SMatrix{n,n}, SVector{n}, SMatrix{n,2}),
34+
(MMatrix{n,n}, MVector{n}, SMatrix{n,2})),
35+
eltya in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloat}, Int),
36+
eltyb in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloat})
3737

38-
eval(quote
39-
A = $t($eltya == Int ? rand(1:7, $n, $n) : convert(Matrix{$eltya}, ($eltya <: Complex ? complex.(randn($n, $n), randn($n, $n)) : randn($n, $n)) |> z -> chol(z'z) |> z -> $(uplo == :U) ? z : ctranspose(z)))
40-
b = convert(Matrix{$eltyb}, $eltya <: Complex ? real(A)*ones($n, 2) : A*ones($n, 2))
41-
SA = $t($m(A.data))
42-
Sx = SA \ $v(b[:, 1])
43-
x = A \ b[:, 1]
44-
@test typeof(Sx) <: StaticVector # test not falling back to Base
45-
@test Sx x
46-
@test eltype(Sx) == eltype(x)
47-
SX = SA \ $u(b)
48-
X = A \ b
49-
@test typeof(SX) <: StaticMatrix # test not falling back to Base
50-
@test SX X
51-
@test eltype(SX) == eltype(X)
52-
end)
38+
A = t(eltya == Int ? rand(1:7, n, n) : convert(Matrix{eltya}, (eltya <: Complex ? complex.(randn(n,n), randn(n,n)) : randn(n,n)) |> z -> chol(z'z) |> z -> uplo == :U ? z : ctranspose(z)))
39+
b = convert(Matrix{eltyb}, eltya <: Complex ? real(A)*ones(n,2) : A*ones(n,2))
40+
SA = t(m(A.data))
41+
Sx = SA \ v(b[:, 1])
42+
x = A \ b[:, 1]
43+
@test Sx isa StaticVector # test not falling back to Base
44+
@test Sx x
45+
@test eltype(Sx) == eltype(x)
46+
SX = SA \ u(b)
47+
X = A \ b
48+
@test SX isa StaticMatrix # test not falling back to Base
49+
@test SX X
50+
@test eltype(SX) == eltype(X)
5351
end
5452
end

0 commit comments

Comments
 (0)