@@ -12,8 +12,12 @@ include("../src/KLU/klu.jl")
1212
1313LinearSolve. issparsematrixcsc (A:: AbstractSparseMatrixCSC ) = true
1414LinearSolve. issparsematrix (A:: AbstractSparseArray ) = true
15- LinearSolve. make_SparseMatrixCSC (A:: AbstractSparseArray ) = SparseMatrixCSC (size (A)... , getcolptr (A), rowvals (A), nonzeros (A))
16- LinearSolve. makeempty_SparaseMatrixCSC (A:: AbstractSparseArray ) = SparseMatrixCSC (0 , 0 , [1 ], Int[], eltype (A)[])
15+ function LinearSolve. make_SparseMatrixCSC (A:: AbstractSparseArray )
16+ SparseMatrixCSC (size (A)... , getcolptr (A), rowvals (A), nonzeros (A))
17+ end
18+ function LinearSolve. makeempty_SparaseMatrixCSC (A:: AbstractSparseArray )
19+ SparseMatrixCSC (0 , 0 , [1 ], Int[], eltype (A)[])
20+ end
1721
1822function LinearSolve. init_cacheval (alg:: RFLUFactorization ,
1923 A:: Union{AbstractSparseArray, LinearSolve.SciMLOperators.AbstractSciMLOperator} , b, u, Pl, Pr,
@@ -22,7 +26,6 @@ function LinearSolve.init_cacheval(alg::RFLUFactorization,
2226 nothing , nothing
2327end
2428
25-
2629function LinearSolve. init_cacheval (
2730 alg:: QRFactorization , A:: Symmetric{<:Number, <:SparseMatrixCSC} , b, u, Pl, Pr,
2831 maxiters:: Int , abstol, reltol, verbose:: Bool ,
3235
3336function LinearSolve. handle_sparsematrixcsc_lu (A:: AbstractSparseMatrixCSC )
3437 lu (SparseMatrixCSC (size (A)... , getcolptr (A), rowvals (A), nonzeros (A)),
35- check = false )
38+ check = false )
3639end
3740
3841function LinearSolve. defaultalg (
3942 A:: Symmetric{<:Number, <:SparseMatrixCSC} , b, :: OperatorAssumptions{Bool} )
40- LinearSolve. DefaultLinearSolver (LinearSolve. DefaultAlgorithmChoice. CHOLMODFactorization)
43+ LinearSolve. DefaultLinearSolver (LinearSolve. DefaultAlgorithmChoice. CHOLMODFactorization)
4144end
4245
4346function LinearSolve. defaultalg (A:: AbstractSparseMatrixCSC{Tv, Ti} , b,
6164const PREALLOCATED_UMFPACK = SparseArrays. UMFPACK. UmfpackLU (SparseMatrixCSC (0 , 0 , [1 ],
6265 Int[], Float64[]))
6366
64- function LinearSolve. init_cacheval (alg:: UMFPACKFactorization , A:: SparseMatrixCSC{Float64, Int} , b, u,
67+ function LinearSolve. init_cacheval (
68+ alg:: UMFPACKFactorization , A:: SparseMatrixCSC{Float64, Int} , b, u,
6569 Pl, Pr,
6670 maxiters:: Int , abstol, reltol,
6771 verbose:: Bool , assumptions:: OperatorAssumptions )
6872 PREALLOCATED_UMFPACK
6973end
7074
71- function LinearSolve. init_cacheval (alg:: UMFPACKFactorization , A:: AbstractSparseArray , b, u, Pl, Pr,
75+ function LinearSolve. init_cacheval (
76+ alg:: UMFPACKFactorization , A:: AbstractSparseArray , b, u, Pl, Pr,
7277 maxiters:: Int , abstol,
7378 reltol,
7479 verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -78,7 +83,8 @@ function LinearSolve.init_cacheval(alg::UMFPACKFactorization, A::AbstractSparseA
7883 rowvals (A), nonzeros (A)))
7984end
8085
81- function SciMLBase. solve! (cache:: LinearSolve.LinearCache , alg:: UMFPACKFactorization ; kwargs... )
86+ function SciMLBase. solve! (
87+ cache:: LinearSolve.LinearCache , alg:: UMFPACKFactorization ; kwargs... )
8288 A = cache. A
8389 A = convert (AbstractMatrix, A)
8490 if cache. isfresh
@@ -116,14 +122,16 @@ end
116122const PREALLOCATED_KLU = KLU. KLUFactorization (SparseMatrixCSC (0 , 0 , [1 ], Int[],
117123 Float64[]))
118124
119- function LinearSolve. init_cacheval (alg:: KLUFactorization , A:: SparseMatrixCSC{Float64, Int} , b, u, Pl,
125+ function LinearSolve. init_cacheval (
126+ alg:: KLUFactorization , A:: SparseMatrixCSC{Float64, Int} , b, u, Pl,
120127 Pr,
121128 maxiters:: Int , abstol, reltol,
122129 verbose:: Bool , assumptions:: OperatorAssumptions )
123130 PREALLOCATED_KLU
124131end
125132
126- function LinearSolve. init_cacheval (alg:: KLUFactorization , A:: AbstractSparseArray , b, u, Pl, Pr,
133+ function LinearSolve. init_cacheval (
134+ alg:: KLUFactorization , A:: AbstractSparseArray , b, u, Pl, Pr,
127135 maxiters:: Int , abstol,
128136 reltol,
129137 verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -182,7 +190,7 @@ function LinearSolve.init_cacheval(alg::NormalCholeskyFactorization,
182190 Symmetric{<: Number , <: AbstractSparseArray }}, b, u, Pl, Pr,
183191 maxiters:: Int , abstol, reltol, verbose:: Bool ,
184192 assumptions:: OperatorAssumptions )
185- LinearSolve. ArrayInterface. cholesky_instance (convert (AbstractMatrix, A))
193+ LinearSolve. ArrayInterface. cholesky_instance (convert (AbstractMatrix, A))
186194end
187195
188196# Specialize QR for the non-square case
@@ -221,7 +229,8 @@ function pattern_changed(fact, A::SparseArrays.SparseMatrixCSC)
221229 fact. rowval)
222230end
223231
224- function LinearSolve. defaultalg (A:: AbstractSparseMatrixCSC{<:Union{Float64, ComplexF64}, Ti} , b,
232+ function LinearSolve. defaultalg (
233+ A:: AbstractSparseMatrixCSC{<:Union{Float64, ComplexF64}, Ti} , b,
225234 assump:: OperatorAssumptions{Bool} ) where {Ti}
226235 if assump. issq
227236 if length (b) <= 10_000 && length (nonzeros (A)) / length (A) < 2e-4
@@ -242,4 +251,4 @@ LinearSolve.PrecompileTools.@compile_workload begin
242251 sol = solve (prob, UMFPACKFactorization ())
243252end
244253
245- end
254+ end
0 commit comments