@@ -12,8 +12,12 @@ include("../src/KLU/klu.jl")
12
12
13
13
LinearSolve. issparsematrixcsc (A:: AbstractSparseMatrixCSC ) = true
14
14
LinearSolve. 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
17
21
18
22
function LinearSolve. init_cacheval (alg:: RFLUFactorization ,
19
23
A:: Union{AbstractSparseArray, LinearSolve.SciMLOperators.AbstractSciMLOperator} , b, u, Pl, Pr,
@@ -22,7 +26,6 @@ function LinearSolve.init_cacheval(alg::RFLUFactorization,
22
26
nothing , nothing
23
27
end
24
28
25
-
26
29
function LinearSolve. init_cacheval (
27
30
alg:: QRFactorization , A:: Symmetric{<:Number, <:SparseMatrixCSC} , b, u, Pl, Pr,
28
31
maxiters:: Int , abstol, reltol, verbose:: Bool ,
32
35
33
36
function LinearSolve. handle_sparsematrixcsc_lu (A:: AbstractSparseMatrixCSC )
34
37
lu (SparseMatrixCSC (size (A)... , getcolptr (A), rowvals (A), nonzeros (A)),
35
- check = false )
38
+ check = false )
36
39
end
37
40
38
41
function LinearSolve. defaultalg (
39
42
A:: Symmetric{<:Number, <:SparseMatrixCSC} , b, :: OperatorAssumptions{Bool} )
40
- LinearSolve. DefaultLinearSolver (LinearSolve. DefaultAlgorithmChoice. CHOLMODFactorization)
43
+ LinearSolve. DefaultLinearSolver (LinearSolve. DefaultAlgorithmChoice. CHOLMODFactorization)
41
44
end
42
45
43
46
function LinearSolve. defaultalg (A:: AbstractSparseMatrixCSC{Tv, Ti} , b,
61
64
const PREALLOCATED_UMFPACK = SparseArrays. UMFPACK. UmfpackLU (SparseMatrixCSC (0 , 0 , [1 ],
62
65
Int[], Float64[]))
63
66
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,
65
69
Pl, Pr,
66
70
maxiters:: Int , abstol, reltol,
67
71
verbose:: Bool , assumptions:: OperatorAssumptions )
68
72
PREALLOCATED_UMFPACK
69
73
end
70
74
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,
72
77
maxiters:: Int , abstol,
73
78
reltol,
74
79
verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -78,7 +83,8 @@ function LinearSolve.init_cacheval(alg::UMFPACKFactorization, A::AbstractSparseA
78
83
rowvals (A), nonzeros (A)))
79
84
end
80
85
81
- function SciMLBase. solve! (cache:: LinearSolve.LinearCache , alg:: UMFPACKFactorization ; kwargs... )
86
+ function SciMLBase. solve! (
87
+ cache:: LinearSolve.LinearCache , alg:: UMFPACKFactorization ; kwargs... )
82
88
A = cache. A
83
89
A = convert (AbstractMatrix, A)
84
90
if cache. isfresh
@@ -116,14 +122,16 @@ end
116
122
const PREALLOCATED_KLU = KLU. KLUFactorization (SparseMatrixCSC (0 , 0 , [1 ], Int[],
117
123
Float64[]))
118
124
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,
120
127
Pr,
121
128
maxiters:: Int , abstol, reltol,
122
129
verbose:: Bool , assumptions:: OperatorAssumptions )
123
130
PREALLOCATED_KLU
124
131
end
125
132
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,
127
135
maxiters:: Int , abstol,
128
136
reltol,
129
137
verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -182,7 +190,7 @@ function LinearSolve.init_cacheval(alg::NormalCholeskyFactorization,
182
190
Symmetric{<: Number , <: AbstractSparseArray }}, b, u, Pl, Pr,
183
191
maxiters:: Int , abstol, reltol, verbose:: Bool ,
184
192
assumptions:: OperatorAssumptions )
185
- LinearSolve. ArrayInterface. cholesky_instance (convert (AbstractMatrix, A))
193
+ LinearSolve. ArrayInterface. cholesky_instance (convert (AbstractMatrix, A))
186
194
end
187
195
188
196
# Specialize QR for the non-square case
@@ -221,7 +229,8 @@ function pattern_changed(fact, A::SparseArrays.SparseMatrixCSC)
221
229
fact. rowval)
222
230
end
223
231
224
- function LinearSolve. defaultalg (A:: AbstractSparseMatrixCSC{<:Union{Float64, ComplexF64}, Ti} , b,
232
+ function LinearSolve. defaultalg (
233
+ A:: AbstractSparseMatrixCSC{<:Union{Float64, ComplexF64}, Ti} , b,
225
234
assump:: OperatorAssumptions{Bool} ) where {Ti}
226
235
if assump. issq
227
236
if length (b) <= 10_000 && length (nonzeros (A)) / length (A) < 2e-4
@@ -242,4 +251,4 @@ LinearSolve.PrecompileTools.@compile_workload begin
242
251
sol = solve (prob, UMFPACKFactorization ())
243
252
end
244
253
245
- end
254
+ end
0 commit comments