@@ -5,41 +5,35 @@ import Pardiso
55
66export PardisoJL
77
8- struct PardisoJL{A} <: SciMLLinearSolveAlgorithm
9- nthreads:: Union{Int, Nothing}
10- solver_type:: Union{Int, Pardiso.Solver, Nothing}
11- matrix_type:: Union{Int, Pardiso.MatrixType, Nothing}
12- solve_phase:: Union{Int, Pardiso.Phase, Nothing}
13- release_phase:: Union{Int, Nothing}
14- iparm:: Union{A, Nothing}
15- dparm:: Union{A, Nothing}
16- end
17-
18- function PardisoJL (solver_type= Pardiso. nothing ,)
19-
20- return PardisoJL (nthreads, solver_type, matrix_type, solve_phase,
21- release_phase, iparm, dparm)
8+ Base. @kwdef struct PardisoJL <: SciMLLinearSolveAlgorithm
9+ nprocs:: Union{Int, Nothing} = nothing
10+ solver_type:: Union{Int, Pardiso.Solver, Nothing} = nothing
11+ matrix_type:: Union{Int, Pardiso.MatrixType, Nothing} = nothing
12+ solve_phase:: Union{Int, Pardiso.Phase, Nothing} = nothing
13+ release_phase:: Union{Int, Nothing} = nothing
14+ iparm:: Union{Vector{Tuple{Int,Int}}, Nothing} = nothing
15+ dparm:: Union{Vector{Tuple{Int,Int}}, Nothing} = nothing
2216end
2317
2418function init_cacheval (alg:: PardisoJL , cache:: LinearCache )
25- @unpack nthreads , solver_type, matrix_type, iparm, dparm = alg
19+ @unpack nprocs , solver_type, matrix_type, iparm, dparm = alg
2620
27- solver = Pardiso. PARDISO_LOADED[] ? PardisoSolver () : MKLPardisoSolver ()
21+ solver = Pardiso. PARDISO_LOADED[] ? Pardiso . PardisoSolver () : Pardiso . MKLPardisoSolver ()
2822
2923 Pardiso. pardisoinit (solver) # default initialization
3024
31- nthreads != = nothing && Pardiso. set_nprocs! (ps, nthreads )
25+ nprocs != = nothing && Pardiso. set_nprocs! (ps, nprocs )
3226 solver_type != = nothing && Pardiso. set_solver! (solver, key)
3327 matrix_type != = nothing && Pardiso. set_matrixtype! (solver, matrix_type)
3428 cache. verbose && Pardiso. set_msglvl! (solver, Pardiso. MESSAGE_LEVEL_ON)
3529
36- iparm != = nothing && begin # pass in vector of tuples like [(iparm, key)]
30+ if iparm != = nothing # pass in vector of tuples like [(iparm, key)]
3731 for i in length (iparm)
3832 Pardiso. set_iparm! (solver, iparm[i]. .. )
3933 end
4034 end
4135
42- dparm != = nothing && begin
36+ if dparm != = nothing
4337 for i in length (dparm)
4438 Pardiso. set_dparm! (solver, dparm[i]. .. )
4539 end
@@ -49,7 +43,10 @@ function init_cacheval(alg::PardisoJL, cache::LinearCache)
4943end
5044
5145function SciMLBase. solve (cache:: LinearCache , alg:: PardisoJL ; kwargs... )
52- @unpack A, b, u, cacheval = cache
46+ @unpack A, b, u = cache
47+ if A isa DiffEqArrayOperator
48+ A = A. A
49+ end
5350
5451 if cache. isfresh
5552 solver = init_cacheval (alg, cache)
@@ -58,15 +55,15 @@ function SciMLBase.solve(cache::LinearCache, alg::PardisoJL; kwargs...)
5855
5956 abstol = cache. abstol
6057 reltol = cache. reltol
61- kwargs = (abstol= abstol, reltol= reltol, alg . kwargs ... )
58+ kwargs = (abstol= abstol, reltol= reltol)
6259
6360 """
6461 figure out whatever phase is. should set_phase call be in init_cacheval?
6562 can we use phase to store factorization in cache?
6663 """
67- Pardiso. set_phase! (cacheval, alg. solve_phase)
68- Pardiso. solve! (cacheval, u, A, b)
69- Pardiso. set_phase! (cacheval, alg. release_phase) # is this necessary?
64+ alg . solve_phase != = nothing && Pardiso. set_phase! (cacheval, alg. solve_phase)
65+ Pardiso. solve! (cache . cacheval, u, A, b)
66+ alg . release_phase != = nothing && Pardiso. set_phase! (cacheval, alg. release_phase) # is this necessary?
7067
7168 return cache. u
7269end
0 commit comments