KSP Solvers Using HIFIR (hifir4py.ksp)

KSP Solvers Using HIFIR (hifir4py.ksp)

KSP Solvers Using HIFIR (hifir4py.ksp)

Contents

Solvers

gmres_hif(A, b[, M]) HIF-preconditioned (right) restarted GMRES
gmres(*args, **kw) An alias of gmres_hif
pipit_hifir(A, b, n_null[, M]) PIPIT solver for solving the pseudoinverse solution
pipit(*args, **kw) Alias of pipit_hifir
orth_null(A, n_null, M, leftnull, restart, …) Compute multiple (small dimension) null-space components

Note

gmres_hif is designed for solving consistent systems, in that the right-hand side is in \(\mathcal{R}(\boldsymbol{A})\). On the other hand, pipit_hifir is designed for seeking the pseudoinverse solution of (potentially) inconsistent systems; it is based on a combination of orth_null and gmres_hif. The users should not call orth_null in general.

Miscellany

GMRES_WorkSpace(n, restart, dtype) Workspace class for GMRES solver
FGMRES_WorkSpace(*args, **kw) Workspace buffer for flexible GMRES (FGMRES)

Note

FGMRES_WorkSpace can also be used in gmres_hif. Both GMRES_WorkSpace and FGMRES_WorkSpace are optional, but should be used for getting good performance for sequences of calls of solvers.

Example Usage

Here, we only show the simplest and most straightforward way to use our HIF-preconditioned GMRES and PIPIT solvers. For advanced usage, refer to the examples in gmres_hif and pipit_hifir.

HIF-preconditioned GMRES(\(m\))

>>> import numpy as np
>>> from scipy.sparse import rand
>>> from hifir4py import *
>>> A = rand(20, 20, 0.5)
>>> b = A.dot(np.ones(20))
>>> x, flag, info = gmres_hif(A, b)  # HIF is factorized inside gmres_hif
>>> assert flag == 0, "GMRES failed with flag={}".format(flag)
>>> print("GMRES iterations are {}".format(info["iters"]))

We refer the readers to this more comprehensive example.

PIPIT solver

We refer the readers to this more comprehensive example, which solves a linear elasticity with pure traction boundary conditions in 3D. This system has six-dimensional null space and is inconsistent.