11module LinearSolvePardiso
22
33using Pardiso, LinearSolve, SciMLBase
4+ using SparseArrays
5+ using SparseArrays: nonzeros, rowvals, getcolptr
6+
47using UnPack
58
69Base. @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
1215end
1316
1417MKLPardisoFactorize (; kwargs... ) = PardisoJL (; solver_type = 0 , kwargs... )
@@ -17,9 +20,19 @@ LinearSolve.needs_concrete_A(alg::PardisoJL) = true
1720
1821# TODO schur complement functionality
1922
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+ )
2336 @unpack nprocs, solver_type, matrix_type, iparm, dparm = alg
2437 A = convert (AbstractMatrix, A)
2538
@@ -90,7 +103,12 @@ function LinearSolve.init_cacheval(alg::PardisoJL, A, b, u, Pl, Pr, maxiters::In
90103 Pardiso. set_iparm! (solver, 3 , round (Int, abs (log10 (reltol)), RoundDown) * 10 + 1 )
91104 end
92105
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+ )
94112
95113 return solver
96114end
0 commit comments