@@ -6,31 +6,37 @@ mutable struct PardisoLU{Tv, Ti} <: AbstractPardisoLU{Tv,Ti}
66 phash:: UInt64
77end
88
9- function PardisoLU {Tv,Ti} () where {Tv,Ti}
9+ function PardisoLU {Tv,Ti} (;iparm = nothing ,dparm = nothing ,matrixtype = nothing ) where {Tv,Ti}
1010 fact= PardisoLU {Tv,Ti} (nothing ,Pardiso. PardisoSolver (),0 )
11- set_default_matrixtype ! (fact)
11+ default_initialize ! (fact,iparm,dparm,matrixtype )
1212end
1313
1414"""
1515```
16- PardisoLU(;valuetype=Float64, indextype=Int64)
17- PardisoLU(matrix)
16+ PardisoLU(;valuetype=Float64,
17+ indextype=Int64,
18+ iparm::Vector,
19+ dparm::Vector,
20+ matrixtype=Int)
21+
22+ PardisoLU(matrix; iparm,dparm,matrixtype)
1823```
1924
2025LU factorization based on pardiso. For using this, you need to issue `using Pardiso`
2126and have the pardiso library from [pardiso-project.org](https://pardiso-project.org)
2227[installed](https://github.com/JuliaSparse/Pardiso.jl#pardiso-60).
2328
24- For (setting Pardiso internal parameters)[https://github.com/JuliaSparse/Pardiso.jl#readme],
25- you can access the `PardisoSolver` e.g. like
29+ The optional keyword arguments `matrixtype`, `iparm` and `dparm` are
30+ (Pardiso internal parameters)[https://github.com/JuliaSparse/Pardiso.jl#readme].
31+
32+ Forsetting them, one can also access the `PardisoSolver` e.g. like
2633```
2734using Pardiso
2835plu=PardisoLU()
2936Pardiso.set_iparm!(plu.ps,5,13.0)
3037```
3138"""
32- PardisoLU (;valuetype:: Type = Float64, indextype:: Type = Int64)= PardisoLU {valuetype,indextype} ()
33-
39+ PardisoLU (;valuetype:: Type = Float64, indextype:: Type = Int64, kwargs... )= PardisoLU {valuetype,indextype} (;kwargs... )
3440
3541
3642# ############################################################################################
@@ -40,39 +46,60 @@ mutable struct MKLPardisoLU{Tv, Ti} <: AbstractPardisoLU{Tv,Ti}
4046 phash:: UInt64
4147end
4248
43- function MKLPardisoLU {Tv,Ti} () where {Tv,Ti}
49+ function MKLPardisoLU {Tv,Ti} (;iparm = nothing ,matrixtype = nothing ) where {Tv,Ti}
4450 fact= MKLPardisoLU {Tv,Ti} (nothing ,Pardiso. MKLPardisoSolver (),0 )
45- set_default_matrixtype ! (fact)
51+ default_initialize ! (fact, iparm, nothing ,matrixtype )
4652end
4753
4854
4955"""
5056```
51- MKLPardisoLU(;valuetype=Float64, indextype=Int64)
52- MKLPardisoLU(matrix)
57+ MKLPardisoLU(;valuetype=Float64,
58+ indextype=Int64,
59+ iparm::Vector,
60+ matrixtype=Int)
61+
62+ MKLPardisoLU(matrix; iparm, matrixtype)
5363```
5464
5565LU factorization based on pardiso. For using this, you need to issue `using Pardiso`.
5666This version uses the early 2000's fork in Intel's MKL library.
5767
68+ The optional keyword arguments `matrixtype` and `iparm` are
69+ (Pardiso internal parameters)[https://github.com/JuliaSparse/Pardiso.jl#readme].
5870
59- For (setting Pardiso internal parameters)[https://github.com/JuliaSparse/Pardiso.jl#readme],
60- you can access the `PardisoSolver` e.g. like
71+ For setting them you can also access the `PardisoSolver` e.g. like
6172```
6273using Pardiso
6374plu=MKLPardisoLU()
6475Pardiso.set_iparm!(plu.ps,5,13.0)
6576```
6677"""
67- MKLPardisoLU (;valuetype:: Type = Float64, indextype:: Type = Int64)= MKLPardisoLU {valuetype,indextype} ()
78+ MKLPardisoLU (;valuetype:: Type = Float64, indextype:: Type = Int64,kwargs ... )= MKLPardisoLU {valuetype,indextype} (;kwargs ... )
6879
6980
7081# #########################################################################################
71- function set_default_matrixtype! (fact:: AbstractPardisoLU{Tv,Ti} ) where {Tv, Ti}
72- if Tv<: Complex
73- Pardiso. set_matrixtype! (fact. ps,Pardiso. COMPLEX_NONSYM)
82+ function default_initialize! (fact:: AbstractPardisoLU{Tv,Ti} , iparm,dparm,matrixtype) where {Tv, Ti}
83+ if ! isnothing (matrixtype)
84+ my_matrixtype= matrixtype
85+ elseif Tv<: Complex
86+ my_matrixtype= Pardiso. COMPLEX_NONSYM
7487 else
75- Pardiso. set_matrixtype! (fact. ps,Pardiso. REAL_NONSYM)
88+ my_matrixtype= Pardiso. REAL_NONSYM
89+ end
90+
91+ Pardiso. set_matrixtype! (fact. ps,Pardiso. REAL_NONSYM)
92+
93+ if ! isnothing (iparm)
94+ for i= 1 : min (length (iparm),length (fact. ps. iparm))
95+ Pardiso. set_iparm! (fact. ps,i,iparm[i])
96+ end
97+ end
98+
99+ if ! isnothing (dparm)
100+ for i= 1 : min (length (dparm),length (fact. ps. dparm))
101+ Pardiso. set_dparm! (fact. ps,i,dparm[i])
102+ end
76103 end
77104 fact
78105end
@@ -82,7 +109,6 @@ function update!(lufact::AbstractPardisoLU{Tv,Ti}) where {Tv, Ti}
82109 flush! (lufact. A)
83110 Acsc= lufact. A. cscmatrix
84111 if lufact. phash!= lufact. A. phash
85- Pardiso. pardisoinit (ps)
86112 Pardiso. set_phase! (ps, Pardiso. RELEASE_ALL)
87113 Pardiso. pardiso (ps, Tv[], Acsc, Tv[])
88114 Pardiso. set_phase! (ps, Pardiso. ANALYSIS_NUM_FACT)
0 commit comments