Arnoldi Iteration
ExponentialUtilities.arnoldi — Function
arnoldi(A,b[;m,tol,opnorm,iop]) -> KsPerform Arnoldi iterations to obtain the Krylov subspace $K_m(A, b)$.
Arguments
A: a square matrix or a matrix-free operator satisfying the Matrix-Free Operator Interface page in the manual.b: starting vector.
Keywords
m: requested Krylov dimension, defaultmin(30, size(A, 1)).ishermitian: select Lanczos for a Hermitian operator; defaults toLinearAlgebra.ishermitian(A).- Additional keywords are forwarded to
arnoldi!, includingtol,iop, andopnorm.
Returns
A populated KrylovSubspace. Its m can be smaller than requested after a happy breakdown.
Examples
A = [-2.0 1.0; 0.0 -1.0]
b = [1.0, 0.0]
Ks = arnoldi(A, b; m = 2)The first m + 1 columns of Ks.V and the leading (m + 1) by m block of Ks.H are related by the recurrence formula
v_1=b,\quad Av_j = \sum_{i=1}^{j+1}h_{ij}v_i\quad(j = 1,2,\ldots,m)iop determines the length of the incomplete orthogonalization procedure [1]. The default value of 0 indicates full Arnoldi. For symmetric/Hermitian A, iop will be ignored and the Lanczos algorithm will be used instead.
Refer to KrylovSubspace for more information regarding the output.
Happy-breakdown occurs whenever norm(v_j) < tol * opnorm, in this case, the dimension of Ks is smaller than m.
ExponentialUtilities.arnoldi! — Function
arnoldi!(Ks,A,b[;tol,m,opnorm,iop,init]) -> KsPopulate an existing KrylovSubspace without allocating its basis.
Arguments
Ks: reusable Krylov storage whose element and storage types must supportAandb.A: square matrix or matrix-free operator.b: starting vector.
Keywords
tol: happy-breakdown threshold, default1e-7.m: requested Krylov dimension, bounded byKs.maxiterunless the cache is resized.ishermitian: selectlanczos!for Hermitian operators.iop: incomplete-orthogonalization length;0performs full Arnoldi.init,t,mu,l: advanced controls for continuing or augmented Krylov constructions.
Returns
The mutated Ks.
Examples
A = [-2.0 1.0; 0.0 -1.0]
b = [1.0, 0.0]
Ks = KrylovSubspace{Float64}(length(b), 2)
arnoldi!(Ks, A, b; m = 2)ExponentialUtilities.lanczos! — Function
lanczos!(Ks,A,b[;tol,m,opnorm]) -> KsPopulate an existing KrylovSubspace with the Lanczos recurrence for a Hermitian operator.
Arguments
Ks: reusable Krylov storage with real-valued Hessenberg coefficients.A: Hermitian matrix or matrix-free operator.b: starting vector.
Keywords
tol, m, opnorm, init, t, mu, and l have the same role as for arnoldi!. Call this only when A is Hermitian for the scalar product implemented by mul!.
Returns
The mutated Ks.
Examples
using LinearAlgebra
A = Hermitian([-2.0 1.0; 1.0 -2.0])
b = [1.0, 0.0]
Ks = KrylovSubspace{Float64, Float64}(length(b), 2)
lanczos!(Ks, A, b; m = 2)API
ExponentialUtilities.KrylovSubspace — Type
KrylovSubspace{T}(n, [maxiter = 30]) -> Ks
KrylovSubspace{T, U, VType}(n, [maxiter = 30]) -> KsConstruct an uninitialized Krylov subspace to be filled by arnoldi! or lanczos!.
Arguments
T: element type of the Krylov basis.U: element type of the Hessenberg matrix. Usereal(T)for a Hermitian problem.VType: matrix storage type for the basis. It must supportVType(undef, rows, columns); choose a GPU-backed matrix type for GPU vectors.n: dimension of the operator domain.maxiter: maximum Krylov dimension, defaulting to30.augmented: number of rows reserved for an augmented operator, defaulting to0.
Fields
m: current Krylov dimension. It can be smaller thanmaxiterafter a happy breakdown.maxiter: allocated maximum Krylov dimension.augmented: number of augmented rows.beta: norm of the starting vector from the last factorization.wasbreakdown: whether the last factorization ended in a happy breakdown.V: orthonormal Krylov basis storage.H: Hessenberg or tridiagonal recurrence-coefficient storage.
Returns
An uninitialized KrylovSubspace. Call arnoldi! or lanczos! before using its basis or coefficients.
Examples
A = [-2.0 1.0; 1.0 -2.0]
b = [1.0, 0.0]
Ks = KrylovSubspace{Float64}(length(b), 2)
arnoldi!(Ks, A, b)- 1Koskela, A. (2015). Approximating the matrix exponential of an advection-diffusion operator using the incomplete orthogonalization method. In Numerical Mathematics and Advanced Applications-ENUMATH 2013 (pp. 345-353). Springer, Cham.