1
1
module LinearSolvePardiso
2
2
3
3
using Pardiso, LinearSolve, SciMLBase
4
+ using SparseArrays
5
+ using SparseArrays: nonzeros, rowvals, getcolptr
6
+
4
7
using UnPack
5
8
6
9
Base. @kwdef struct PardisoJL <: LinearSolve.SciMLLinearSolveAlgorithm
7
- nprocs:: Union{Int, Nothing} = nothing
8
- solver_type:: Union{Int, Pardiso.Solver, Nothing} = nothing
9
- matrix_type:: Union{Int, Pardiso.MatrixType, Nothing} = nothing
10
- iparm:: Union{Vector{Tuple{Int, Int}}, Nothing} = nothing
11
- dparm:: Union{Vector{Tuple{Int, Int}}, Nothing} = nothing
10
+ nprocs:: Union{Int,Nothing} = nothing
11
+ solver_type:: Union{Int,Pardiso.Solver,Nothing} = nothing
12
+ matrix_type:: Union{Int,Pardiso.MatrixType,Nothing} = nothing
13
+ iparm:: Union{Vector{Tuple{Int,Int}},Nothing} = nothing
14
+ dparm:: Union{Vector{Tuple{Int,Int}},Nothing} = nothing
12
15
end
13
16
14
17
MKLPardisoFactorize (; kwargs... ) = PardisoJL (; solver_type = 0 , kwargs... )
@@ -17,9 +20,19 @@ LinearSolve.needs_concrete_A(alg::PardisoJL) = true
17
20
18
21
# TODO schur complement functionality
19
22
20
- function LinearSolve. init_cacheval (alg:: PardisoJL , A, b, u, Pl, Pr, maxiters:: Int , abstol,
21
- reltol, verbose:: Bool ,
22
- assumptions:: LinearSolve.OperatorAssumptions )
23
+ function LinearSolve. init_cacheval (
24
+ alg:: PardisoJL ,
25
+ A,
26
+ b,
27
+ u,
28
+ Pl,
29
+ Pr,
30
+ maxiters:: Int ,
31
+ abstol,
32
+ reltol,
33
+ verbose:: Bool ,
34
+ assumptions:: LinearSolve.OperatorAssumptions ,
35
+ )
23
36
@unpack nprocs, solver_type, matrix_type, iparm, dparm = alg
24
37
A = convert (AbstractMatrix, A)
25
38
@@ -90,7 +103,12 @@ function LinearSolve.init_cacheval(alg::PardisoJL, A, b, u, Pl, Pr, maxiters::In
90
103
Pardiso. set_iparm! (solver, 3 , round (Int, abs (log10 (reltol)), RoundDown) * 10 + 1 )
91
104
end
92
105
93
- Pardiso. pardiso (solver, u, SparseMatrixCSC (size (A)... , getcolptr (A), rowvals (A), nonzeros (A), b)
106
+ Pardiso. pardiso (
107
+ solver,
108
+ u,
109
+ SparseMatrixCSC (size (A)... , getcolptr (A), rowvals (A), nonzeros (A)),
110
+ b,
111
+ )
94
112
95
113
return solver
96
114
end
0 commit comments