Stats Types
Krylov.KrylovStats
— TypeAbstract type for statistics returned by (block) Krylov solvers.
Krylov.SimpleStats
— TypeType for storing statistics returned by the majority of (block) Krylov solvers.
The fields are as follows:
niter
: The total number of iterations completed by the solver;solved
: Indicates whether the solver successfully reached convergence (true
if solved,false
otherwise);inconsistent
: Flags whether the system was detected as inconsistent (i.e., whenb
is not in the range ofA
);indefinite
: Flags whether the system was detected as indefinite (i.e., whenA
is not positive definite);residuals
: A vector containing the residual norms at each iteration;Aresiduals
: A vector ofA'
-residual norms at each iteration;Acond
: An estimate of the condition number of matrixA
.timer
: The elapsed time (in seconds) taken by the solver to complete all iterations;status
: A string indicating the outcome of the solve, providing additional details beyondsolved
.
Krylov.LanczosStats
— TypeType for storing statistics returned by CG-LANCZOS. The fields are as follows:
- niter
- solved
- residuals
- indefinite
- Anorm
- Acond
- timer
- status
Krylov.LanczosShiftStats
— TypeType for storing statistics returned by CG-LANCZOS-SHIFT and CGLS-LANCZOS-SHIFT. The fields are as follows:
- niter
- solved
- residuals
- indefinite
- Anorm
- Acond
- timer
- status
Krylov.SymmlqStats
— TypeType for storing statistics returned by SYMMLQ. The fields are as follows:
- niter
- solved
- residuals
- residualscg
- errors
- errorscg
- Anorm
- Acond
- timer
- status
Krylov.AdjointStats
— TypeType for storing statistics returned by adjoint systems solvers BiLQR and TriLQR. The fields are as follows:
- niter
- solved_primal
- solved_dual
- residuals_primal
- residuals_dual
- timer
- status
Krylov.LNLQStats
— TypeType for storing statistics returned by the LNLQ method. The fields are as follows:
- niter
- solved
- residuals
- errorwithbnd
- errorbndx
- errorbndy
- timer
- status
Krylov.LSLQStats
— TypeType for storing statistics returned by the LSLQ method. The fields are as follows:
- niter
- solved
- inconsistent
- residuals
- Aresiduals
- err_lbnds
- errorwithbnd
- errubndslq
- errubndscg
- timer
- status
Krylov.LsmrStats
— TypeType for storing statistics returned by LSMR. The fields are as follows:
- niter
- solved
- inconsistent
- residuals
- Aresiduals
- Acond
- Anorm
- xNorm
- timer
- status
Workspace of Krylov methods
Krylov.KrylovWorkspace
— TypeAbstract type for using Krylov solvers in-place.
Krylov.MinresWorkspace
— TypeWorkspace for the in-place method minres!
.
The following outer constructors can be used to initialize this workspace:
workspace = MinresWorkspace(m, n, S; window = 5)
workspace = MinresWorkspace(A, b; window = 5)
workspace = MinresWorkspace(kc::KrylovConstructor; window = 5)
Krylov.MinaresWorkspace
— TypeWorkspace for the in-place method minares!
.
The following outer constructors can be used to initialize this workspace:
workspace = MinaresWorkspace(m, n, S)
workspace = MinaresWorkspace(A, b)
workspace = MinaresWorkspace(kc::KrylovConstructor)
Krylov.CgWorkspace
— TypeWorkspace for the in-place method cg!
.
The following outer constructors can be used to initialize this workspace:
workspace = CgWorkspace(m, n, S)
workspace = CgWorkspace(A, b)
workspace = CgWorkspace(kc::KrylovConstructor)
Krylov.CrWorkspace
— TypeWorkspace for the in-place method cr!
.
The following outer constructors can be used to initialize this workspace:
workspace = CrWorkspace(m, n, S)
workspace = CrWorkspace(A, b)
workspace = CrWorkspace(kc::KrylovConstructor)
Krylov.CarWorkspace
— TypeWorkspace for the in-place method car!
.
The following outer constructors can be used to initialize this workspace:
workspace = CarWorkspace(m, n, S)
workspace = CarWorkspace(A, b)
workspace = CarWorkspace(kc::KrylovConstructor)
Krylov.SymmlqWorkspace
— TypeWorkspace for the in-place method symmlq!
.
The following outer constructors can be used to initialize this workspace:
workspace = SymmlqWorkspace(m, n, S)
workspace = SymmlqWorkspace(A, b)
workspace = SymmlqWorkspace(kc::KrylovConstructor)
Krylov.CgLanczosWorkspace
— TypeWorkspace for the in-place method cg_lanczos!
.
The following outer constructors can be used to initialize this workspace:
workspace = CgLanczosWorkspace(m, n, S)
workspace = CgLanczosWorkspace(A, b)
workspace = CgLanczosWorkspace(kc::KrylovConstructor)
Krylov.CgLanczosShiftWorkspace
— TypeWorkspace for the in-place method cg_lanczos_shift!
.
The following outer constructors can be used to initialize this workspace:
workspace = CgLanczosShiftWorkspace(m, n, nshifts, S)
workspace = CgLanczosShiftWorkspace(A, b, nshifts)
workspace = CgLanczosShiftWorkspace(kc::KrylovConstructor, nshifts)
Krylov.MinresQlpWorkspace
— TypeWorkspace for the in-place method minres_qlp!
.
The following outer constructors can be used to initialize this workspace:
workspace = MinresQlpWorkspace(m, n, S)
workspace = MinresQlpWorkspace(A, b)
workspace = MinresQlpWorkspace(kc::KrylovConstructor)
Krylov.DiomWorkspace
— TypeWorkspace for the in-place method diom!
.
The following outer constructors can be used to initialize this workspace:
workspace = DiomWorkspace(m, n, S; memory = 20)
workspace = DiomWorkspace(A, b; memory = 20)
workspace = DiomWorkspace(kc::KrylovConstructor; memory = 20)
memory
is set to n
if the value given is larger than n
.
Krylov.FomWorkspace
— TypeWorkspace for the in-place method fom!
.
The following outer constructors can be used to initialize this workspace:
workspace = FomWorkspace(m, n, S; memory = 20)
workspace = FomWorkspace(A, b; memory = 20)
workspace = FomWorkspace(kc::KrylovConstructor; memory = 20)
memory
is set to n
if the value given is larger than n
.
Krylov.DqgmresWorkspace
— TypeWorkspace for the in-place method dqgmres!
.
The following outer constructors can be used to initialize this workspace:
workspace = DqgmresWorkspace(m, n, S; memory = 20)
workspace = DqgmresWorkspace(A, b; memory = 20)
workspace = DqgmresWorkspace(kc::KrylovConstructor; memory = 20)
memory
is set to n
if the value given is larger than n
.
Krylov.GmresWorkspace
— TypeWorkspace for the in-place method gmres!
.
The following outer constructors can be used to initialize this workspace:
workspace = GmresWorkspace(m, n, S; memory = 20)
workspace = GmresWorkspace(A, b; memory = 20)
workspace = GmresWorkspace(kc::KrylovConstructor; memory = 20)
memory
is set to n
if the value given is larger than n
.
Krylov.UsymlqWorkspace
— TypeWorkspace for the in-place method usymlq!
.
The following outer constructors can be used to initialize this workspace:
workspace = UsymlqWorkspace(m, n, S)
workspace = UsymlqWorkspace(A, b)
workspace = UsymlqWorkspace(kc::KrylovConstructor)
Krylov.UsymqrWorkspace
— TypeWorkspace for the in-place method usymqr!
.
The following outer constructors can be used to initialize this workspace:
workspace = UsymqrWorkspace(m, n, S)
workspace = UsymqrWorkspace(A, b)
workspace = UsymqrWorkspace(kc::KrylovConstructor)
Krylov.TricgWorkspace
— TypeWorkspace for the in-place method tricg!
.
The following outer constructors can be used to initialize this workspace:
workspace = TricgWorkspace(m, n, S)
workspace = TricgWorkspace(A, b)
workspace = TricgWorkspace(kc::KrylovConstructor)
Krylov.TrimrWorkspace
— TypeWorkspace for the in-place method trimr!
.
The following outer constructors can be used to initialize this workspace:
workspace = TrimrWorkspace(m, n, S)
workspace = TrimrWorkspace(A, b)
workspace = TrimrWorkspace(kc::KrylovConstructor)
Krylov.TrilqrWorkspace
— TypeWorkspace for the in-place method trilqr!
.
The following outer constructors can be used to initialize this workspace:
workspace = TrilqrWorkspace(m, n, S)
workspace = TrilqrWorkspace(A, b)
workspace = TrilqrWorkspace(kc::KrylovConstructor)
Krylov.CgsWorkspace
— TypeWorkspace for the in-place method cgs!
.
The following outer constructors can be used to initialize this workspace:s
workspace = CgsWorkspace(m, n, S)
workspace = CgsWorkspace(A, b)
workspace = CgsWorkspace(kc::KrylovConstructor)
Krylov.BicgstabWorkspace
— TypeWorkspace for the in-place method bicgstab!
.
The following outer constructors can be used to initialize this workspace:
workspace = BicgstabWorkspace(m, n, S)
workspace = BicgstabWorkspace(A, b)
workspace = BicgstabWorkspace(kc::KrylovConstructor)
Krylov.BilqWorkspace
— TypeWorkspace for the in-place method bilq!
.
The following outer constructors can be used to initialize this workspace:
workspace = BilqWorkspace(m, n, S)
workspace = BilqWorkspace(A, b)
workspace = BilqWorkspace(kc::KrylovConstructor)
Krylov.QmrWorkspace
— TypeWorkspace for the in-place method qmr!
.
The following outer constructors can be used to initialize this workspace:
workspace = QmrWorkspace(m, n, S)
workspace = QmrWorkspace(A, b)
workspace = QmrWorkspace(kc::KrylovConstructor)
Krylov.BilqrWorkspace
— TypeWorkspace for the in-place method bilqr!
.
The following outer constructors can be used to initialize this workspace:
workspace = BilqrWorkspace(m, n, S)
workspace = BilqrWorkspace(A, b)
workspace = BilqrWorkspace(kc::KrylovConstructor)
Krylov.CglsWorkspace
— TypeWorkspace for the in-place method cgls!
.
The following outer constructors can be used to initialize this workspace:
workspace = CglsWorkspace(m, n, S)
workspace = CglsWorkspace(A, b)
workspace = CglsWorkspace(kc::KrylovConstructor)
Krylov.CglsLanczosShiftWorkspace
— TypeWorkspace for the in-place method cgls_lanczos_shift!
.
The following outer constructors can be used to initialize this workspace::
workspace = CglsLanczosShiftWorkspace(m, n, nshifts, S)
workspace = CglsLanczosShiftWorkspace(A, b, nshifts)
workspace = CglsLanczosShiftWorkspace(kc::KrylovConstructor, nshifts)
Krylov.CrlsWorkspace
— TypeWorkspace for the in-place method crls!
.
The following outer constructors can be used to initialize this workspace:
workspace = CrlsWorkspace(m, n, S)
workspace = CrlsWorkspace(A, b)
workspace = CrlsWorkspace(kc::KrylovConstructor)
Krylov.CgneWorkspace
— TypeWorkspace for the in-place method cgne!
.
The following outer constructors can be used to initialize this workspace:
workspace = CgneWorkspace(m, n, S)
workspace = CgneWorkspace(A, b)
workspace = CgneWorkspace(kc::KrylovConstructor)
Krylov.CrmrWorkspace
— TypeWorkspace for the in-place method crmr!
.
The following outer constructors can be used to initialize this workspace:
workspace = CrmrWorkspace(m, n, S)
workspace = CrmrWorkspace(A, b)
workspace = CrmrWorkspace(kc::KrylovConstructor)
Krylov.LslqWorkspace
— TypeWorkspace for the in-place method lslq!
.
The following outer constructors can be used to initialize this workspace:
workspace = LslqWorkspace(m, n, S)
workspace = LslqWorkspace(A, b)
workspace = LslqWorkspace(kc::KrylovConstructor)
Krylov.LsqrWorkspace
— TypeWorkspace for the in-place method lsqr!
.
The following outer constructors can be used to initialize this workspace:
workspace = LsqrWorkspace(m, n, S)
workspace = LsqrWorkspace(A, b)
workspace = LsqrWorkspace(kc::KrylovConstructor)
Krylov.LsmrWorkspace
— TypeWorkspace for the in-place method lsmr!
.
The following outer constructors can be used to initialize this workspace:
workspace = LsmrWorkspace(m, n, S)
workspace = LsmrWorkspace(A, b)
workspace = LsmrWorkspace(kc::KrylovConstructor)
Krylov.LnlqWorkspace
— TypeWorkspace for the in-place method lnlq!
.
The following outer constructors can be used to initialize this workspace:
workspace = LnlqWorkspace(m, n, S)
workspace = LnlqWorkspace(A, b)
workspace = LnlqWorkspace(kc::KrylovConstructor)
Krylov.CraigWorkspace
— TypeWorkspace for the in-place method craig!
.
The following outer constructors can be used to initialize this workspace:
workspace = CraigWorkspace(m, n, S)
workspace = CraigWorkspace(A, b)
workspace = CraigWorkspace(kc::KrylovConstructor)
Krylov.CraigmrWorkspace
— TypeWorkspace for the in-place method craigmr!
.
The following outer constructors can be used to initialize this workspace:
workspace = CraigmrWorkspace(m, n, S)
workspace = CraigmrWorkspace(A, b)
workspace = CraigmrWorkspace(kc::KrylovConstructor)
Krylov.GpmrWorkspace
— TypeWorkspace for the in-place method gpmr!
.
The following outer constructors can be used to initialize this workspace:
workspace = GpmrWorkspace(m, n, S; memory = 20)
workspace = GpmrWorkspace(A, b; memory = 20)
workspace = GpmrWorkspace(kc::KrylovConstructor; memory = 20)
memory
is set to n + m
if the value given is larger than n + m
.
Krylov.FgmresWorkspace
— TypeWorkspace for the in-place method fgmres!
.
The following outer constructors can be used to initialize this workspace:
workspace = FgmresWorkspace(m, n, S; memory = 20)
workspace = FgmresWorkspace(A, b; memory = 20)
workspace = FgmresWorkspace(kc::KrylovConstructor; memory = 20)
memory
is set to n
if the value given is larger than n
.
Workspace of block-Krylov methods
Krylov.BlockKrylovWorkspace
— TypeAbstract type for using block Krylov solvers in-place.
Krylov.BlockMinresWorkspace
— TypeWorkspace for the in-place method block_minres!
.
The following outer constructors can be used to initialize this workspace:
workspace = BlockMinresWorkspace(m, n, p, SV, SM)
workspace = BlockMinresWorkspace(A, B)
Krylov.BlockGmresWorkspace
— TypeWorkspace for the in-place method block_gmres!
.
The following outer constructors can be used to initialize this workspace:
workspace = BlockGmresWorkspace(m, n, p, SV, SM; memory = 5)
workspace = BlockGmresWorkspace(A, B; memory = 5)
memory
is set to div(n,p)
if the value given is larger than div(n,p)
.
Utilities
Krylov.roots_quadratic
— Functionroots = roots_quadratic(q₂, q₁, q₀; nitref)
Find the real roots of the quadratic
q(x) = q₂ x² + q₁ x + q₀,
where q₂, q₁ and q₀ are real. Care is taken to avoid numerical cancellation. Optionally, nitref
steps of iterative refinement may be performed to improve accuracy. By default, nitref=1
.
Krylov.sym_givens
— Function(c, s, ρ) = sym_givens(a, b)
Numerically stable symmetric Givens reflection. Given a
and b
reals, return (c, s, ρ)
such that
[ c s ] [ a ] = [ ρ ]
[ s -c ] [ b ] = [ 0 ].
Numerically stable symmetric Givens reflection. Given a
and b
complexes, return (c, s, ρ)
with c real and (s, ρ) complexes such that
[ c s ] [ a ] = [ ρ ]
[ s̅ -c ] [ b ] = [ 0 ].
Krylov.to_boundary
— Functionroots = to_boundary(n, x, d, radius; flip, xNorm2, dNorm2)
Given a trust-region radius radius
, a vector x
lying inside the trust-region and a direction d
, return σ1
and σ2
such that
‖x + σi d‖ = radius, i = 1, 2
in the Euclidean norm. n
is the length of vectors x
and d
. If known, ‖x‖² and ‖d‖² may be supplied with xNorm2
and dNorm2
.
If flip
is set to true
, σ1
and σ2
are computed such that
‖x - σi d‖ = radius, i = 1, 2.
Krylov.vec2str
— Functions = vec2str(x; ndisp)
Display an array in the form
[ -3.0e-01 -5.1e-01 1.9e-01 ... -2.3e-01 -4.4e-01 2.4e-01 ]
with (ndisp - 1)/2 elements on each side.
Krylov.ktypeof
— FunctionS = ktypeof(v)
Return the most relevant storage type S
based on the type of v
.
Krylov.kzeros
— Functionv = kzeros(S, n)
Create a vector of storage type S
of length n
only composed of zero.
Krylov.kones
— Functionv = kones(S, n)
Create a vector of storage type S
of length n
only composed of one.
Krylov.vector_to_matrix
— FunctionM = vector_to_matrix(S)
Return the dense matrix storage type M
related to the dense vector storage type S
.
Krylov.matrix_to_vector
— FunctionS = matrix_to_vector(M)
Return the dense vector storage type S
related to the dense matrix storage type M
.