Skip to content

Commit b68ebc3

Browse files
committed
Fix tests
1 parent 3260599 commit b68ebc3

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Setfield = "1"
103103
SparseArrays = "1.9"
104104
Sparspak = "0.3.6"
105105
StaticArraysCore = "1"
106+
StaticArrays = "1"
106107
Test = "1"
107108
UnPack = "1"
108109
julia = "1.9"
@@ -128,7 +129,8 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
128129
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
129130
RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd"
130131
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
132+
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
131133
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
132134

133135
[targets]
134-
test = ["Aqua", "Test", "IterativeSolvers", "InteractiveUtils", "JET", "KrylovKit", "Pkg", "Random", "SafeTestsets", "MultiFloats", "ForwardDiff", "HYPRE", "MPI", "BlockDiagonals", "Enzyme", "FiniteDiff", "BandedMatrices", "FastAlmostBandedMatrices"]
136+
test = ["Aqua", "Test", "IterativeSolvers", "InteractiveUtils", "JET", "KrylovKit", "Pkg", "Random", "SafeTestsets", "MultiFloats", "ForwardDiff", "HYPRE", "MPI", "BlockDiagonals", "Enzyme", "FiniteDiff", "BandedMatrices", "FastAlmostBandedMatrices", "StaticArrays"]

src/factorization.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,14 @@ else
286286
end
287287
end
288288

289-
function init_cacheval(alg::CholeskyFactorization, A::SMatrix, b, u, Pl, Pr,
289+
function init_cacheval(alg::CholeskyFactorization, A::SMatrix{S1, S2}, b, u, Pl, Pr,
290290
maxiters::Int, abstol, reltol, verbose::Bool,
291-
assumptions::OperatorAssumptions)
292-
cholesky(SMatrix{1, 1}(one(eltype(A)))) # StaticArrays doesn't have the pivot argument. Prevent generic fallback.
291+
assumptions::OperatorAssumptions) where {S1, S2}
292+
# StaticArrays doesn't have the pivot argument. Prevent generic fallback.
293+
# CholeskyFactorization is part of DefaultLinearSolver, so it is possible that `A` is
294+
# not Hermitian.
295+
(!issquare(A) || !ishermitian(A)) && return nothing
296+
cholesky(A)
293297
end
294298

295299
function init_cacheval(alg::CholeskyFactorization, A, b, u, Pl, Pr,

test/default_algs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ solve(prob)
5050
A = rand(4, 4)
5151
b = rand(4)
5252
prob = LinearProblem(A, b)
53-
JET.@test_opt init(prob, nothing)
53+
VERSION v"1.10-" && JET.@test_opt init(prob, nothing)
5454
JET.@test_opt solve(prob, LUFactorization())
5555
JET.@test_opt solve(prob, GenericLUFactorization())
5656
@test_skip JET.@test_opt solve(prob, QRFactorization())

test/static_arrays.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ b = SVector{5}(rand(5))
66
for alg in (nothing, LUFactorization(), SVDFactorization(), CholeskyFactorization(),
77
KrylovJL_GMRES())
88
sol = solve(LinearProblem(A, b), alg)
9-
@show norm(A * sol .- b)
109
@test norm(A * sol .- b) < 1e-10
1110
end
1211

0 commit comments

Comments
 (0)