@@ -93,6 +93,12 @@ function SciMLBase.solve!(cache::LinearCache, alg::LUFactorization; kwargs...)
9393 fact = lu (A, check = false )
9494 end
9595 cache. cacheval = fact
96+
97+ if ! LinearAlgebra. issuccess (fact)
98+ return SciMLBase. build_linear_solution (
99+ alg, cache. u, nothing , cache; retcode = ReturnCode. Failure)
100+ end
101+
96102 cache. isfresh = false
97103 end
98104
@@ -187,7 +193,11 @@ function do_factorization(alg::QRFactorization, A, b, u)
187193 A = convert (AbstractMatrix, A)
188194 if ArrayInterface. can_setindex (typeof (A))
189195 if alg. inplace && ! (A isa SparseMatrixCSC) && ! (A isa GPUArraysCore. AnyGPUArray)
190- fact = qr! (A, alg. pivot)
196+ if A isa Symmetric
197+ fact = qr (A, alg. pivot)
198+ else
199+ fact = qr! (A, alg. pivot)
200+ end
191201 else
192202 fact = qr (A) # CUDA.jl does not allow other args!
193203 end
@@ -203,6 +213,12 @@ function init_cacheval(alg::QRFactorization, A, b, u, Pl, Pr,
203213 ArrayInterface. qr_instance (convert (AbstractMatrix, A), alg. pivot)
204214end
205215
216+ function init_cacheval (alg:: QRFactorization , A:: Symmetric , b, u, Pl, Pr,
217+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
218+ assumptions:: OperatorAssumptions )
219+ return qr (convert (AbstractMatrix, A), alg. pivot)
220+ end
221+
206222const PREALLOCATED_QR_ColumnNorm = ArrayInterface. qr_instance (rand (1 , 1 ), ColumnNorm ())
207223
208224function init_cacheval (alg:: QRFactorization{ColumnNorm} , A:: Matrix{Float64} , b, u, Pl, Pr,
@@ -1023,6 +1039,12 @@ function SciMLBase.solve!(cache::LinearCache, alg::RFLUFactorization{P, T};
10231039 end
10241040 fact = RecursiveFactorization. lu! (A, ipiv, Val (P), Val (T), check = false )
10251041 cache. cacheval = (fact, ipiv)
1042+
1043+ if ! LinearAlgebra. issuccess (fact)
1044+ return SciMLBase. build_linear_solution (
1045+ alg, cache. u, nothing , cache; retcode = ReturnCode. Failure)
1046+ end
1047+
10261048 cache. isfresh = false
10271049 end
10281050 y = ldiv! (cache. u, @get_cacheval (cache, :RFLUFactorization )[1 ], cache. b)
0 commit comments