Skip to content

Commit

Permalink
Add example for UMFPACK control vector (#449)
Browse files Browse the repository at this point in the history
* Add example for UMFPACK control vector

Note that Julia modifies the UMFPACK defaults to disable iterative refinement.

Add an example to illustrate usage of the UMFPACK control vector to reenable iterative refinement

* Update umfpack.jl
  • Loading branch information
sjdaines authored Oct 2, 2023
1 parent 605237e commit 05ac950
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/solvers/umfpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,16 @@ The permutation `q` can either be a permutation vector or `nothing`. If no permu
is provided or `q` is `nothing`, UMFPACK's default is used. If the permutation is not zero-based, a
zero-based copy is made.
The `control` vector defaults to the package's default configuration for UMFPACK, but can be changed by passing a
vector of length `UMFPACK_CONTROL`. See the UMFPACK manual for possible configurations. The corresponding
variables are named `JL_UMFPACK_` since Julia uses one-based indexing.
The `control` vector defaults to the Julia SparseArrays package's default configuration for UMFPACK (NB: this is modified from the UMFPACK defaults to
disable iterative refinement), but can be changed by passing a vector of length `UMFPACK_CONTROL`, see the UMFPACK manual for possible configurations.
For example to reenable iterative refinement:
umfpack_control = SparseArrays.UMFPACK.get_umfpack_control(Float64, Int64) # read Julia default configuration for a Float64 sparse matrix
SparseArrays.UMFPACK.show_umf_ctrl(umfpack_control) # optional - display values
umfpack_control[SparseArrays.UMFPACK.JL_UMFPACK_IRSTEP] = 2.0 # reenable iterative refinement (2 is UMFPACK default max iterative refinement steps)
Alu = lu(A; control = umfpack_control)
x = Alu \\ b # solve Ax = b, including UMFPACK iterative refinement
The individual components of the factorization `F` can be accessed by indexing:
Expand Down

0 comments on commit 05ac950

Please sign in to comment.