6666 end
6767end
6868
69- function defaultalg (A:: GPUArraysCore.AbstractGPUArray , b, :: OperatorAssumptions{true} )
69+ function defaultalg (A:: GPUArraysCore.AbstractGPUArray , b, assump :: OperatorAssumptions{true} )
7070 if VERSION >= v " 1.8-"
7171 LUFactorization ()
7272 else
7373 QRFactorization ()
7474 end
7575end
7676
77- function defaultalg (A, b:: GPUArraysCore.AbstractGPUArray , :: OperatorAssumptions{true} )
77+ function defaultalg (A:: GPUArraysCore.AbstractGPUArray , b, assump:: OperatorAssumptions{true,IllConditioned} )
78+ QRFactorization ()
79+ end
80+
81+ function defaultalg (A, b:: GPUArraysCore.AbstractGPUArray , assump:: OperatorAssumptions{true} )
7882 if VERSION >= v " 1.8-"
7983 LUFactorization ()
8084 else
8185 QRFactorization ()
8286 end
8387end
8488
89+ function defaultalg (A, b:: GPUArraysCore.AbstractGPUArray , assump:: OperatorAssumptions{true,IllConditioned} )
90+ QRFactorization ()
91+ end
92+
8593function defaultalg (A:: SciMLBase.AbstractSciMLOperator , b,
8694 assumptions:: OperatorAssumptions{true} )
8795 if has_ldiv! (A)
@@ -121,6 +129,11 @@ function defaultalg(A::GPUArraysCore.AbstractGPUArray, b::GPUArraysCore.Abstract
121129 end
122130end
123131
132+ function defaultalg (A:: GPUArraysCore.AbstractGPUArray , b:: GPUArraysCore.AbstractGPUArray ,
133+ :: OperatorAssumptions{true,IllConditioned} )
134+ QRFactorization ()
135+ end
136+
124137function defaultalg (A:: GPUArraysCore.AbstractGPUArray , b, :: OperatorAssumptions{false} )
125138 QRFactorization ()
126139end
@@ -136,13 +149,13 @@ function defaultalg(A::GPUArraysCore.AbstractGPUArray, b::GPUArraysCore.Abstract
136149end
137150
138151# Allows A === nothing as a stand-in for dense matrix
139- function defaultalg (A, b, :: OperatorAssumptions{true} )
152+ function defaultalg (A, b, assump :: OperatorAssumptions{true} )
140153 # Special case on Arrays: avoid BLAS for RecursiveFactorization.jl when
141154 # it makes sense according to the benchmarks, which is dependent on
142155 # whether MKL or OpenBLAS is being used
143156 if (A === nothing && ! (b isa GPUArraysCore. AbstractGPUArray)) || A isa Matrix
144157 if (A === nothing || eltype (A) <: Union{Float32, Float64, ComplexF32, ComplexF64} ) &&
145- ArrayInterface. can_setindex (b)
158+ ArrayInterface. can_setindex (b) && __conditioning (assump) != IllConditioned
146159 if length (b) <= 10
147160 alg = GenericLUFactorization ()
148161 elseif (length (b) <= 100 || (isopenblas () && length (b) <= 500 )) &&
@@ -154,6 +167,10 @@ function defaultalg(A, b, ::OperatorAssumptions{true})
154167 else
155168 alg = LUFactorization ()
156169 end
170+ elseif __conditioning (assump) === VeryIllConditioned
171+ alg = QRFactorization ()
172+ elseif __conditioning (assump) === SuperIllConditioned
173+ alg = SVDFactorization (false , LinearAlgebra. QRIteration ())
157174 else
158175 alg = LUFactorization ()
159176 end
@@ -170,10 +187,18 @@ function defaultalg(A, b, ::OperatorAssumptions{true})
170187 alg
171188end
172189
173- function defaultalg (A, b, :: OperatorAssumptions{false} )
190+ function defaultalg (A, b, :: OperatorAssumptions{false,IllConditioned } )
174191 QRFactorization ()
175192end
176193
194+ function defaultalg (A, b, :: OperatorAssumptions{false,VeryIllConditioned} )
195+ QRFactorization ()
196+ end
197+
198+ function defaultalg (A, b, :: OperatorAssumptions{false,SuperIllConditioned} )
199+ SVDFactorization (false , LinearAlgebra. QRIteration ())
200+ end
201+
177202# # Catch high level interface
178203
179204function SciMLBase. solve (cache:: LinearCache , alg:: Nothing ,
0 commit comments