Skip to content

Commit c343e8d

Browse files
Merge pull request #453 from SciML/normalchol
Fix potential uninitialized in Symmetric building of NormalChol cache
2 parents 26ac213 + f10bc70 commit c343e8d

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

src/factorization.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ function init_cacheval(alg::NormalCholeskyFactorization, A, b, u, Pl, Pr,
10101010
maxiters::Int, abstol, reltol, verbose::Bool,
10111011
assumptions::OperatorAssumptions)
10121012
A_ = convert(AbstractMatrix, A)
1013-
return ArrayInterface.cholesky_instance(Symmetric((A)' * A), alg.pivot)
1013+
return ArrayInterface.cholesky_instance(Symmetric(Matrix{eltype(A)}(undef,0,0)), alg.pivot)
10141014
end
10151015

10161016
function init_cacheval(alg::NormalCholeskyFactorization,

test/default_algs.jl

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,25 @@ solve(prob)
4545
prob = LinearProblem(sprand(11000, 11000, 0.5), zeros(11000))
4646
solve(prob)
4747

48-
@static if VERSION >= v"v1.9-"
49-
# Test inference
50-
A = rand(4, 4)
51-
b = rand(4)
52-
prob = LinearProblem(A, b)
53-
VERSION v"1.10-" && JET.@test_opt init(prob, nothing)
54-
JET.@test_opt solve(prob, LUFactorization())
55-
JET.@test_opt solve(prob, GenericLUFactorization())
56-
@test_skip JET.@test_opt solve(prob, QRFactorization())
57-
JET.@test_opt solve(prob, DiagonalFactorization())
58-
#JET.@test_opt solve(prob, SVDFactorization())
59-
#JET.@test_opt solve(prob, KrylovJL_GMRES())
48+
# Test inference
49+
A = rand(4, 4)
50+
b = rand(4)
51+
prob = LinearProblem(A, b)
52+
VERSION v"1.10-" && JET.@test_opt init(prob, nothing)
53+
JET.@test_opt solve(prob, LUFactorization())
54+
JET.@test_opt solve(prob, GenericLUFactorization())
55+
@test_skip JET.@test_opt solve(prob, QRFactorization())
56+
JET.@test_opt solve(prob, DiagonalFactorization())
57+
#JET.@test_opt solve(prob, SVDFactorization())
58+
#JET.@test_opt solve(prob, KrylovJL_GMRES())
6059

61-
prob = LinearProblem(sparse(A), b)
62-
#JET.@test_opt solve(prob, UMFPACKFactorization())
63-
#JET.@test_opt solve(prob, KLUFactorization())
64-
#JET.@test_opt solve(prob, SparspakFactorization())
65-
#JET.@test_opt solve(prob)
66-
@inferred solve(prob)
67-
@inferred init(prob, nothing)
68-
end
60+
prob = LinearProblem(sparse(A), b)
61+
#JET.@test_opt solve(prob, UMFPACKFactorization())
62+
#JET.@test_opt solve(prob, KLUFactorization())
63+
#JET.@test_opt solve(prob, SparspakFactorization())
64+
#JET.@test_opt solve(prob)
65+
@inferred solve(prob)
66+
@inferred init(prob, nothing)
67+
68+
prob = LinearProblem(big.(rand(10, 10)), big.(zeros(10)))
69+
solve(prob)

0 commit comments

Comments
 (0)