@@ -66,10 +66,24 @@ for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int)
66
66
capds = cholfact (apds)
67
67
@test inv (capds)* apds ≈ eye (n)
68
68
@test abs ((det (capds) - det (apd))/ det (capds)) <= ε* κ* n
69
+ if eltya <: BlasReal
70
+ capds = cholfact! (copy (apds))
71
+ @test inv (capds)* apds ≈ eye (n)
72
+ @test abs ((det (capds) - det (apd))/ det (capds)) <= ε* κ* n
73
+ end
69
74
else
70
75
capdh = cholfact (apdh)
71
76
@test inv (capdh)* apdh ≈ eye (n)
72
77
@test abs ((det (capdh) - det (apd))/ det (capdh)) <= ε* κ* n
78
+ capdh = cholfact! (copy (apdh))
79
+ @test inv (capdh)* apdh ≈ eye (n)
80
+ @test abs ((det (capdh) - det (apd))/ det (capdh)) <= ε* κ* n
81
+ capdh = cholfact! (copy (apd))
82
+ @test inv (capdh)* apdh ≈ eye (n)
83
+ @test abs ((det (capdh) - det (apd))/ det (capdh)) <= ε* κ* n
84
+ capdh = cholfact! (copy (apd), :L )
85
+ @test inv (capdh)* apdh ≈ eye (n)
86
+ @test abs ((det (capdh) - det (apd))/ det (capdh)) <= ε* κ* n
73
87
end
74
88
75
89
# test chol of 2x2 Strang matrix
@@ -125,6 +139,7 @@ for eltya in (Float32, Float64, Complex64, Complex128, BigFloat, Int)
125
139
@test size (cpapd) == size (apd)
126
140
@test full (copy (cpapd)) ≈ apd
127
141
@test det (cpapd) ≈ det (apd)
142
+ @test logdet (cpapd) ≈ logdet (apd)
128
143
@test cpapd[:P ]* cpapd[:L ]* cpapd[:U ]* cpapd[:P ]' ≈ apd
129
144
end
130
145
@@ -203,7 +218,9 @@ let A = complex(randn(10,5), randn(10, 5)), v = complex(randn(5), randn(5))
203
218
F = cholfact (AcA, uplo)
204
219
G = cholfact (BcB, uplo)
205
220
@test LinAlg. lowrankupdate (F, v)[uplo] ≈ G[uplo]
221
+ @test_throws DimensionMismatch LinAlg. lowrankupdate (F, ones (eltype (v), length (v)+ 1 ))
206
222
@test LinAlg. lowrankdowndate (G, v)[uplo] ≈ F[uplo]
223
+ @test_throws DimensionMismatch LinAlg. lowrankdowndate (G, ones (eltype (v), length (v)+ 1 ))
207
224
end
208
225
end
209
226
245
262
@test_throws ArgumentError Base. LinAlg. cholfact! (randn (5 ,5 ),:U ,Val{false })
246
263
@test_throws ArgumentError Base. LinAlg. cholfact! (randn (5 ,5 ),:U ,Val{true })
247
264
@test_throws ArgumentError cholfact (randn (5 ,5 ),:U ,Val{false })
265
+
266
+ # Fail for non-BLAS element types
267
+ @test_throws ArgumentError cholfact! (Hermitian (rand (Float16, 5 ,5 )), Val{true })
0 commit comments