@@ -103,16 +103,10 @@ function init_cacheval(alg::Union{LUFactorization, GenericLUFactorization}, A, b
103
103
ArrayInterface. lu_instance (convert (AbstractMatrix, A))
104
104
end
105
105
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
-
112
106
const PREALLOCATED_LU = ArrayInterface. lu_instance (rand (1 , 1 ))
113
107
114
108
function 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,
116
110
maxiters:: Int , abstol, reltol, verbose:: Bool ,
117
111
assumptions:: OperatorAssumptions )
118
112
PREALLOCATED_LU
181
175
182
176
const PREALLOCATED_QR = ArrayInterface. qr_instance (rand (1 , 1 ))
183
177
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,
185
179
maxiters:: Int , abstol, reltol, verbose:: Bool ,
186
180
assumptions:: OperatorAssumptions )
187
181
PREALLOCATED_QR
260
254
261
255
const PREALLOCATED_CHOLESKY = ArrayInterface. cholesky_instance (rand (1 , 1 ), cholpivot)
262
256
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,
264
258
maxiters:: Int , abstol, reltol, verbose:: Bool ,
265
259
assumptions:: OperatorAssumptions )
266
260
PREALLOCATED_CHOLESKY
352
346
353
347
const PREALLOCATED_SVD = ArrayInterface. svd_instance (rand (1 , 1 ))
354
348
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,
356
350
maxiters:: Int , abstol, reltol, verbose:: Bool ,
357
351
assumptions:: OperatorAssumptions )
358
352
PREALLOCATED_SVD
@@ -677,7 +671,7 @@ function init_cacheval(alg::UMFPACKFactorization,
677
671
nothing
678
672
end
679
673
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,
681
675
Pl, Pr,
682
676
maxiters:: Int , abstol, reltol,
683
677
verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -774,7 +768,7 @@ function init_cacheval(alg::KLUFactorization,
774
768
nothing
775
769
end
776
770
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,
778
772
Pr,
779
773
maxiters:: Int , abstol, reltol,
780
774
verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -810,7 +804,7 @@ function SciMLBase.solve!(cache::LinearCache, alg::KLUFactorization; kwargs...)
810
804
# This won't recompute if it does.
811
805
KLU. klu_analyze! (cacheval)
812
806
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.
814
808
KLU. klu_factor! (cacheval)
815
809
end
816
810
fact = KLU. klu! (cacheval,
@@ -861,7 +855,7 @@ function init_cacheval(alg::CHOLMODFactorization,
861
855
nothing
862
856
end
863
857
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,
865
859
Pl, Pr,
866
860
maxiters:: Int , abstol, reltol,
867
861
verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -917,13 +911,7 @@ function init_cacheval(alg::RFLUFactorization, A, b, u, Pl, Pr, maxiters::Int,
917
911
ArrayInterface. lu_instance (convert (AbstractMatrix, A)), ipiv
918
912
end
919
913
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,
927
915
maxiters:: Int ,
928
916
abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
929
917
ipiv = Vector {LinearAlgebra.BlasInt} (undef, 0 )
@@ -1278,7 +1266,7 @@ function init_cacheval(alg::SparspakFactorization,
1278
1266
nothing
1279
1267
end
1280
1268
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,
1282
1270
Pr, maxiters:: Int , abstol,
1283
1271
reltol,
1284
1272
verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -1316,3 +1304,13 @@ function SciMLBase.solve!(cache::LinearCache, alg::SparspakFactorization; kwargs
1316
1304
y = ldiv! (cache. u, @get_cacheval (cache, :SparspakFactorization ), cache. b)
1317
1305
SciMLBase. build_linear_solution (alg, y, nothing , cache)
1318
1306
end
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