JuliaSparse / Pardiso.jl

Calling the PARDISO library from Julia
Other
100 stars 27 forks source link

Question about "set_iparm!(ps, i, v)" #44

Closed ZenanH closed 5 years ago

ZenanH commented 5 years ago

I learned the following in the README file:

iparm[1] input Description
0 iparm(2) - iparm(64) are filled with default values.
≠0 You must supply all values in components iparm(2) - iparm(64).
iparm[12] input Description
0* Solve a linear system AX = B.
1 Solve a conjugate transposed system A(H)X = B based on the factorization of the matrix A.
2 Solve a transposed system A(T)X = B based on the factorization of the matrix A.

So I think I should set the iparm [1] to ≠0 first.Then I should set iparm [12] to =2 ,that means transpose my sparse matrix (CSC - >CSR)

My code as follows:

using Pardiso
using LinearAlgebra
using SparseArrays

ps = MKLPardisoSolver()
set_iparm!(ps, 1, 1) #not use default values.
set_iparm!(ps, 12, 2) #Solve with transposed or conjugate transposed matrix A. [line 6]

A = sparse([2. 1 0 0; 1 0 1 3; 0 1 2 0; 0 0 1 1])

B = [4.; 4; 2; 1]

X1 = solve(ps, A, B)

After running the code, I type in the repl:

Julia > get_iparm (ps, 12)
2

Here seems to be a reasonable answer.But when I change the code to set_iparm!(ps, 12, 2) in [line 6],get_iparm (ps, 12) still is 2,

That is to say, this line of code doesn't work. Why?

KristofferC commented 5 years ago

Please see the note in the README:

After using functionality in this section, calls should no longer be made to the solve functions but instead directly to the function

pardiso(ps, X, A, B)

This will ensure that the properties you set will not be overwritten.