High-level functions such as linsolve, eigsolve, geneigsolve, svdsolve, exponentiate, and expintegrator follow a consistent interface.
Input: The Linear Map
The first argument A represents the linear map. This can be:
- An instance of
AbstractMatrix. - A function or callable object that encodes the action of the linear map on a vector.
- A Julia
do block that implements the action on a vector x.
Input: Arguments and Keywords
args...: Additional arguments required by the specific solver.kwargs...: Configuration keywords:- Linear map properties:
issymmetric, ishermitian, isposdef. - Solution strategy:
tol (tolerance), krylovdim (Krylov subspace dimension), maxiter (maximum iterations). - Output control:
verbosity.
Output: Results and Convergence Info
Functions return one or more solution entries followed by a final info object of type ConvergeInfo. This object contains convergence status, residuals, the norm of the residual, and the number of operations used.
Verbosity Levels
Control how much information is printed to STDOUT using the verbosity keyword:
SILENT_LEVEL (default): No information printed.WARN_LEVEL: A single message at the end (warning if failed, info if succeeded).STARTSTOP_LEVEL: Information about the current state is displayed after every iteration.verbosity > STARTSTOP_LEVEL: Detailed information about individual Krylov expansion steps is displayed.
# Using a do-block to define the linear map
results..., info = linsolve(args...; kwargs...) do x
y = # implement linear map on x
return y
end