Skip to content

Commit bb3c690

Browse files
committed
fix typo for pardiso
1 parent 6961555 commit bb3c690

File tree

3 files changed

+37
-18
lines changed

3 files changed

+37
-18
lines changed

lib/LinearSolvePardiso/Project.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
88
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
99
Pardiso = "46dd5b70-b6fb-5a00-ae2d-e8fea33afaf2"
1010
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
11+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1112
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"
1213

1314
[compat]
14-
SciMLBase = "1.25"
1515
LinearSolve = "1.24"
16-
Pardiso = "0.5"
16+
Pardiso = "0.5"
17+
SciMLBase = "1.25"
1718
UnPack = "1"
1819
julia = "1.6"
1920

lib/LinearSolvePardiso/src/LinearSolvePardiso.jl

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
module LinearSolvePardiso
22

33
using Pardiso, LinearSolve, SciMLBase
4+
using SparseArrays
5+
using SparseArrays: nonzeros, rowvals, getcolptr
6+
47
using UnPack
58

69
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
1215
end
1316

1417
MKLPardisoFactorize(; 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
96114
end

lib/LinearSolvePardiso/test/runtests.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using LinearSolve, LinearSolvePardiso, SparseArrays, Random
22

3-
A1 = sparse([1.0 0 -2 3
4-
0 5 1 2
5-
-2 1 4 -7
6-
3 2 -7 5])
3+
A1 = sparse([
4+
1.0 0 -2 3
5+
0 5 1 2
6+
-2 1 4 -7
7+
3 2 -7 5
8+
])
79
b1 = rand(4)
810
prob1 = LinearProblem(A1, b1)
911

@@ -17,9 +19,7 @@ cache_kwargs = (; verbose = true, abstol = 1e-8, reltol = 1e-8, maxiter = 30)
1719

1820
prob2 = LinearProblem(A2, b2)
1921

20-
for alg in (PardisoJL(),
21-
MKLPardisoFactorize(),
22-
MKLPardisoIterate())
22+
for alg in (PardisoJL(), MKLPardisoFactorize(), MKLPardisoIterate())
2323
u = solve(prob1, alg; cache_kwargs...).u
2424
@test A1 * u b1
2525

0 commit comments

Comments
 (0)