@@ -103,16 +103,10 @@ function init_cacheval(alg::Union{LUFactorization, GenericLUFactorization}, A, b
103103 ArrayInterface. lu_instance (convert (AbstractMatrix, A))
104104end
105105
106- function init_cacheval (alg:: Union{LUFactorization, GenericLUFactorization} , A:: MatrixOperator , b, u, Pl, Pr,
107- maxiters:: Int , abstol, reltol, verbose:: Bool ,
108- assumptions:: OperatorAssumptions )
109- ArrayInterface. lu_instance (convert (AbstractMatrix, A))
110- end
111-
112106const PREALLOCATED_LU = ArrayInterface. lu_instance (rand (1 , 1 ))
113107
114108function init_cacheval (alg:: Union{LUFactorization, GenericLUFactorization} ,
115- A:: Union{ Matrix{Float64},MatrixOperator{Float64, Matrix{Float64}} } , b, u, Pl, Pr,
109+ A:: Matrix{Float64} , b, u, Pl, Pr,
116110 maxiters:: Int , abstol, reltol, verbose:: Bool ,
117111 assumptions:: OperatorAssumptions )
118112 PREALLOCATED_LU
181175
182176const PREALLOCATED_QR = ArrayInterface. qr_instance (rand (1 , 1 ))
183177
184- function init_cacheval (alg:: QRFactorization , A:: Union{ Matrix{Float64}, MatrixOperator{Float64, Matrix{Float64}} } , b, u, Pl, Pr,
178+ function init_cacheval (alg:: QRFactorization , A:: Matrix{Float64} , b, u, Pl, Pr,
185179 maxiters:: Int , abstol, reltol, verbose:: Bool ,
186180 assumptions:: OperatorAssumptions )
187181 PREALLOCATED_QR
260254
261255const PREALLOCATED_CHOLESKY = ArrayInterface. cholesky_instance (rand (1 , 1 ), cholpivot)
262256
263- function init_cacheval (alg:: CholeskyFactorization , A:: Union{ Matrix{Float64}, MatrixOperator{Float64, Matrix{Float64}} } , b, u, Pl, Pr,
257+ function init_cacheval (alg:: CholeskyFactorization , A:: Matrix{Float64} , b, u, Pl, Pr,
264258 maxiters:: Int , abstol, reltol, verbose:: Bool ,
265259 assumptions:: OperatorAssumptions )
266260 PREALLOCATED_CHOLESKY
352346
353347const PREALLOCATED_SVD = ArrayInterface. svd_instance (rand (1 , 1 ))
354348
355- function init_cacheval (alg:: SVDFactorization , A:: Union{ Matrix{Float64}, MatrixOperator{Float64, Matrix{Float64}} } , b, u, Pl, Pr,
349+ function init_cacheval (alg:: SVDFactorization , A:: Matrix{Float64} , b, u, Pl, Pr,
356350 maxiters:: Int , abstol, reltol, verbose:: Bool ,
357351 assumptions:: OperatorAssumptions )
358352 PREALLOCATED_SVD
@@ -677,7 +671,7 @@ function init_cacheval(alg::UMFPACKFactorization,
677671 nothing
678672end
679673
680- function init_cacheval (alg:: UMFPACKFactorization , A:: Union{ SparseMatrixCSC{Float64, Int}, MatrixOperator{Float64, Matrix{Float64}} } , b, u,
674+ function init_cacheval (alg:: UMFPACKFactorization , A:: SparseMatrixCSC{Float64, Int} , b, u,
681675 Pl, Pr,
682676 maxiters:: Int , abstol, reltol,
683677 verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -774,7 +768,7 @@ function init_cacheval(alg::KLUFactorization,
774768 nothing
775769end
776770
777- function init_cacheval (alg:: KLUFactorization , A:: Union{ SparseMatrixCSC{Float64, Int}, MatrixOperator{Float64, Matrix{Float64}} } , b, u, Pl,
771+ function init_cacheval (alg:: KLUFactorization , A:: SparseMatrixCSC{Float64, Int} , b, u, Pl,
778772 Pr,
779773 maxiters:: Int , abstol, reltol,
780774 verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -810,7 +804,7 @@ function SciMLBase.solve!(cache::LinearCache, alg::KLUFactorization; kwargs...)
810804 # This won't recompute if it does.
811805 KLU. klu_analyze! (cacheval)
812806 copyto! (cacheval. nzval, nonzeros (A))
813- if cache . cacheval. _numeric === C_NULL # We MUST have a numeric factorization for reuse, unlike UMFPACK.
807+ if cacheval. _numeric === C_NULL # We MUST have a numeric factorization for reuse, unlike UMFPACK.
814808 KLU. klu_factor! (cacheval)
815809 end
816810 fact = KLU. klu! (cacheval,
@@ -861,7 +855,7 @@ function init_cacheval(alg::CHOLMODFactorization,
861855 nothing
862856end
863857
864- function init_cacheval (alg:: CHOLMODFactorization , A:: Union{ SparseMatrixCSC{Float64, Int}, MatrixOperator{Float64, Matrix{Float64}} } , b, u,
858+ function init_cacheval (alg:: CHOLMODFactorization , A:: SparseMatrixCSC{Float64, Int} , b, u,
865859 Pl, Pr,
866860 maxiters:: Int , abstol, reltol,
867861 verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -917,13 +911,7 @@ function init_cacheval(alg::RFLUFactorization, A, b, u, Pl, Pr, maxiters::Int,
917911 ArrayInterface. lu_instance (convert (AbstractMatrix, A)), ipiv
918912end
919913
920- function init_cacheval (alg:: RFLUFactorization , A:: MatrixOperator , b, u, Pl, Pr, maxiters:: Int ,
921- abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
922- ipiv = Vector {LinearAlgebra.BlasInt} (undef, min (size (A)... ))
923- ArrayInterface. lu_instance (convert (AbstractMatrix, A)), ipiv
924- end
925-
926- function init_cacheval (alg:: RFLUFactorization , A:: Union{Matrix{Float64}, MatrixOperator{Float64, Matrix{Float64}}} , b, u, Pl, Pr,
914+ function init_cacheval (alg:: RFLUFactorization , A:: Matrix{Float64} , b, u, Pl, Pr,
927915 maxiters:: Int ,
928916 abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
929917 ipiv = Vector {LinearAlgebra.BlasInt} (undef, 0 )
@@ -1278,7 +1266,7 @@ function init_cacheval(alg::SparspakFactorization,
12781266 nothing
12791267end
12801268
1281- function init_cacheval (:: SparspakFactorization , A:: Union{ SparseMatrixCSC{Float64, Int}, MatrixOperator{Float64, Matrix{Float64}} } , b, u, Pl,
1269+ function init_cacheval (:: SparspakFactorization , A:: SparseMatrixCSC{Float64, Int} , b, u, Pl,
12821270 Pr, maxiters:: Int , abstol,
12831271 reltol,
12841272 verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -1316,3 +1304,13 @@ function SciMLBase.solve!(cache::LinearCache, alg::SparspakFactorization; kwargs
13161304 y = ldiv! (cache. u, @get_cacheval (cache, :SparspakFactorization ), cache. b)
13171305 SciMLBase. build_linear_solution (alg, y, nothing , cache)
13181306end
1307+
1308+ for alg in InteractiveUtils. subtypes (AbstractFactorization)
1309+ @eval function init_cacheval (alg:: $alg , A:: MatrixOperator , b, u, Pl, Pr,
1310+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
1311+ assumptions:: OperatorAssumptions )
1312+ init_cacheval (alg, A. A, b, u, Pl, Pr,
1313+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
1314+ assumptions:: OperatorAssumptions )
1315+ end
1316+ end
0 commit comments