@@ -99,6 +99,12 @@ function do_factorization(alg::QRFactorization, A, b, u)
9999 return fact
100100end
101101
102+ function init_cacheval (alg:: QRFactorization , A, b, u, Pl, Pr,
103+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
104+ assumptions:: OperatorAssumptions )
105+ ArrayInterface. qr_instance (convert (AbstractMatrix, A))
106+ end
107+
102108# # SVDFactorization
103109
104110struct SVDFactorization{A} <: AbstractFactorization
@@ -114,6 +120,12 @@ function do_factorization(alg::SVDFactorization, A, b, u)
114120 return fact
115121end
116122
123+ function init_cacheval (alg:: SVDFactorization , A, b, u, Pl, Pr,
124+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
125+ assumptions:: OperatorAssumptions )
126+ ArrayInterface. svd_instance (convert (AbstractMatrix, A))
127+ end
128+
117129# # GenericFactorization
118130
119131struct GenericFactorization{F} <: AbstractFactorization
@@ -172,6 +184,94 @@ function init_cacheval(alg::GenericFactorization{typeof(lu!)}, A::Tridiagonal, b
172184 ArrayInterface. lu_instance (A)
173185end
174186
187+ function init_cacheval (alg:: GenericFactorization{typeof(qr)} , A, b, u, Pl, Pr,
188+ maxiters:: Int ,
189+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
190+ ArrayInterface. qr_instance (convert (AbstractMatrix, A))
191+ end
192+ function init_cacheval (alg:: GenericFactorization{typeof(qr!)} , A, b, u, Pl, Pr,
193+ maxiters:: Int ,
194+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
195+ ArrayInterface. qr_instance (convert (AbstractMatrix, A))
196+ end
197+
198+ function init_cacheval (alg:: GenericFactorization{typeof(qr)} ,
199+ A:: StridedMatrix{<:LinearAlgebra.BlasFloat} , b, u, Pl, Pr,
200+ maxiters:: Int ,
201+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
202+ ArrayInterface. qr_instance (A)
203+ end
204+ function init_cacheval (alg:: GenericFactorization{typeof(qr!)} ,
205+ A:: StridedMatrix{<:LinearAlgebra.BlasFloat} , b, u, Pl, Pr,
206+ maxiters:: Int ,
207+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
208+ ArrayInterface. qr_instance (A)
209+ end
210+ function init_cacheval (alg:: GenericFactorization{typeof(qr)} , A:: Diagonal , b, u, Pl, Pr,
211+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
212+ assumptions:: OperatorAssumptions )
213+ Diagonal (inv .(A. diag))
214+ end
215+ function init_cacheval (alg:: GenericFactorization{typeof(qr)} , A:: Tridiagonal , b, u, Pl, Pr,
216+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
217+ assumptions:: OperatorAssumptions )
218+ ArrayInterface. qr_instance (A)
219+ end
220+ function init_cacheval (alg:: GenericFactorization{typeof(qr!)} , A:: Diagonal , b, u, Pl, Pr,
221+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
222+ assumptions:: OperatorAssumptions )
223+ Diagonal (inv .(A. diag))
224+ end
225+ function init_cacheval (alg:: GenericFactorization{typeof(qr!)} , A:: Tridiagonal , b, u, Pl, Pr,
226+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
227+ assumptions:: OperatorAssumptions )
228+ ArrayInterface. qr_instance (A)
229+ end
230+
231+ function init_cacheval (alg:: GenericFactorization{typeof(svd)} , A, b, u, Pl, Pr,
232+ maxiters:: Int ,
233+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
234+ ArrayInterface. svd_instance (convert (AbstractMatrix, A))
235+ end
236+ function init_cacheval (alg:: GenericFactorization{typeof(svd!)} , A, b, u, Pl, Pr,
237+ maxiters:: Int ,
238+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
239+ ArrayInterface. svd_instance (convert (AbstractMatrix, A))
240+ end
241+
242+ function init_cacheval (alg:: GenericFactorization{typeof(svd)} ,
243+ A:: StridedMatrix{<:LinearAlgebra.BlasFloat} , b, u, Pl, Pr,
244+ maxiters:: Int ,
245+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
246+ ArrayInterface. svd_instance (A)
247+ end
248+ function init_cacheval (alg:: GenericFactorization{typeof(svd!)} ,
249+ A:: StridedMatrix{<:LinearAlgebra.BlasFloat} , b, u, Pl, Pr,
250+ maxiters:: Int ,
251+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
252+ ArrayInterface. svd_instance (A)
253+ end
254+ function init_cacheval (alg:: GenericFactorization{typeof(svd)} , A:: Diagonal , b, u, Pl, Pr,
255+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
256+ assumptions:: OperatorAssumptions )
257+ Diagonal (inv .(A. diag))
258+ end
259+ function init_cacheval (alg:: GenericFactorization{typeof(svd)} , A:: Tridiagonal , b, u, Pl, Pr,
260+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
261+ assumptions:: OperatorAssumptions )
262+ ArrayInterface. svd_instance (A)
263+ end
264+ function init_cacheval (alg:: GenericFactorization{typeof(svd!)} , A:: Diagonal , b, u, Pl, Pr,
265+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
266+ assumptions:: OperatorAssumptions )
267+ Diagonal (inv .(A. diag))
268+ end
269+ function init_cacheval (alg:: GenericFactorization{typeof(svd!)} , A:: Tridiagonal , b, u, Pl, Pr,
270+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
271+ assumptions:: OperatorAssumptions )
272+ ArrayInterface. svd_instance (A)
273+ end
274+
175275function init_cacheval (alg:: GenericFactorization , A:: Diagonal , b, u, Pl, Pr, maxiters:: Int ,
176276 abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
177277 Diagonal (inv .(A. diag))
209309
210310# Fallback, tries to make nonsingular and just factorizes
211311# Try to never use it.
212- function init_cacheval (alg:: Union{QRFactorization, SVDFactorization, GenericFactorization} ,
312+ function init_cacheval (alg:: GenericFactorization ,
213313 A, b, u, Pl, Pr, maxiters:: Int , abstol, reltol, verbose:: Bool ,
214314 assumptions:: OperatorAssumptions )
215315 newA = copy (convert (AbstractMatrix, A))
@@ -221,20 +321,6 @@ function init_cacheval(alg::Union{QRFactorization, SVDFactorization, GenericFact
221321 do_factorization (alg, newA, b, u)
222322end
223323
224- # Ambiguity handling dispatch
225- function init_cacheval (alg:: Union{QRFactorization, SVDFactorization} ,
226- A:: StridedMatrix{<:LinearAlgebra.BlasFloat} , b, u, Pl, Pr,
227- maxiters:: Int ,
228- abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
229- newA = copy (convert (AbstractMatrix, A))
230- if newA isa AbstractSparseMatrix
231- fill! (nonzeros (newA), true )
232- else
233- fill! (newA, true )
234- end
235- do_factorization (alg, newA, b, u)
236- end
237-
238324# Cholesky needs the posdef matrix, for GenericFactorization assume structure is needed
239325function init_cacheval (alg:: Union {GenericFactorization,
240326 GenericFactorization{typeof (cholesky)},
0 commit comments