jInv.LinearSolvers

The LinearSolvers submodule provides wrappers iterative and direct solvers for linear systems such as discretized PDEs.

Supported Packages

The module looks for MUMPS, Pardiso, and SpMatVec.

List of types and methods

# jInv.LinearSolvers.BlockIterativeSolverType.

type BlockIterativeSolver

Fields:

IterMethod - iterative method to apply
PC      - symbol, (:ssor, :jac,...)
maxIter - maximum number of iterations
tol     - tolerance
Ainv    - preconditioner
out     - flag for output
doClear - flag for deleting preconditioner
nthreads - number of threads for spmatvecs
sym      - 0=unsymmetric, 1=symm. pos def, 2=general symmetric
isTranspose - if true, transpose(A) is provided to solver, else A is proved to solver
          default=false, use isTranspose=true for efficiency with caution
          note that A_mul_B! is slower than Ac_mul_B for SparseMatrixCSC

Example getBlockIterativeSolver()

source

# jInv.LinearSolvers.IterativeSolverType.

type jInv.LinearSolvers.IterativeSolver <: AbstractSolver

Fields:

IterMethod - iterative method to apply
PC      - symbol, (:ssor, :jac,...)
maxIter - maximum number of iterations
tol     - tolerance
Ainv    - preconditioner
out     - flag for output
doClear - flag for deleting preconditioner
nthreads - number of threads for spmatvecs
sym      - 0=unsymmetric, 1=symm. pos def, 2=general symmetric
isTranspose - if true, transpose(A) is provided to solver, else A is provided to solver
          default=false, use isTranspose=true for efficiency with caution
          note that A_mul_B! is slower than Ac_mul_B for SparseMatrixCSC

Example:

getIterativeSolver(cg)

source

# jInv.LinearSolvers.JuliaSolverType.

type jInv.LinearSolvers.JuliaSolver<: AbstractSolver

Fields:

Ainv         - holds factorization (LU or Cholesky)
sym          - 0=unsymmetric, 1=symm. pos def, 2=general symmetric
isTransposed - flag whether A comes transposed or not
doClear      - flag to clear factorization
facTime      - cumulative time for factorizations
nSolve       - number of solves
solveTime    - cumnulative time for solves
nFac         - number of factorizations performed

Example:

Ainv = getJuliaSolver()

source

# jInv.LinearSolvers.MUMPSsolverType.

type MUMPSsolver

Fields:

Ainv    - holds MUMPSfactorization
doClear - flag to clear factorization
ooc     - flag for out-of-core option
sym     - 0=unsymmetric, 1=symm. pos def, 2=general symmetric
nFac    - number of factorizations performed
facTime - cumulative time for factorizations
nSolve  - number of solves
solveTime - cumnulative time for solves

Example:

Ainv = getMUMPSsolver()

source

# jInv.LinearSolvers.jInvPardisoSolverType.

type jInvPardisoSolver

Fields:

Ainv    - holds PardisoFactorization
doClear - flag to clear factorization
ooc     - flag for out-of-core option
sym     - 0=unsymmetric, 1=symm. pos def, 2=general symmetric
nFac    - number of factorizations performed
facTime - cumulative time for factorizations
nSolve  - number of solves
solveTime - cumulative time for solves

Example:

Ainv = getjInvPardisoSolver()

source

# jInv.LinearSolvers.getBlockIterativeSolverMethod.

function jInv.LinearSolvers.getBlockIterativeSolver

constructs BlockIterativeSolver

Required Input:

IterMethod::Function   - function handle for linear solvers 
    Inputs are: (A,B,M), A is matrix, B are right hand sides, M is preconditioner
        Examples: 
              IterMethod = blockCG
              IterMethod(A,B;M=M,X=X,tol=1e-1,maxIter=10,out=-1) =
                              blockBiCGSTB(A,b,M1=M,X=X,tol=tol,maxIter=maxIter,out=out)
        The keyword arguments of IterMethod for blockBiCGSTB
        will be initialized with the fields in the IterativeSolver type.
    Outputs are: (X,flag,err,iter), X are approximate solutions

Optional Inputs:

PC::Symbol     - specifies preconditioner, default:ssor
maxIter        - maximum number of iterations, default:500
tol            - tolerance on relative residual, default=1e-5
Ainv           - preconditioner, default=identity
out            - flag for output, default=-1 (no output)
doClear        - flag for clearing the preconditioner, default=true
nthreads       - number of threads to use for matvecs (requires ParSpMatVec.jl), default=4
sym            - 0=unsymmetric, 1=symm. pos def, 2=general symmetric
isTranspose    - if true, transpose(A) is provided to solver, else A is proved to solver
                  default=false, use isTranspose=true for efficiency with caution
                  note that A_mul_B! is slower than Ac_mul_B for SparseMatrixCSC

source

# jInv.LinearSolvers.getIterativeSolverMethod.

function jInv.LinearSolvers.getIterativeSolver

constructs IterativeSolver

Required Input:

IterMethod::Function   - function handle for linear solvers 
    Inputs are: (A,b,M), A is matrix, b is right hand side, M is preconditioner
        Examples: IterMethod = KrylovMethods.cg   #KrylovMethods.cg already has required API
              IterMethod(A,b;M=M,tol=1e-1,maxIter=10,out=-1) =
                              bicgstb(A,b,M1=M,tol=tol,maxIter=maxIter,out=out)
              IterMethod(A,b;M=M,tol=1e-1,maxIter=10,out=-1)  = 
                              gmres(A,b,5,M1=M,tol=tol,maxIter=maxIter,out=out)
        The keyword arguments of IterMethod for bicgstb and gmres
        will be initialized with the fields in the IterativeSolver type.
    Outputs are: (x,flag,err,iter), x is approximate solution

Optional Inputs:

PC::Symbol     - specifies preconditioner, default:ssor
maxIter        - maximum number of iterations, default:500
tol            - tolerance on relative residual, default=1e-5
Ainv           - preconditioner, default=identity
out            - flag for output, default=-1 (no output)
doClear        - flag for clearing the preconditioner, default=true
nthreads       - number of threads to use for matvecs (requires ParSpMatVec.jl), default=4
sym            - 0=unsymmetric, 1=symm. pos def, 2=general symmetric
isTranspose    - if true, transpose(A) is provided to solver, else A is proved to solver
                  default=false, use isTranspose=true for efficiency with caution
                  note that A_mul_B! is slower than Ac_mul_B for SparseMatrixCSC

source

# jInv.LinearSolvers.getJuliaSolverMethod.

function jInv.LinearSolvers.getJuliaSolver

Constructor for JuliaSolver

Optional Keyword Arguments

Ainv = []
sym = 0
isTransposed = 0
doClear = 0

source