BiLQR
Krylov.bilqr — Function
(x, y, stats) = bilqr(A, b::AbstractVector{FC}, c::AbstractVector{FC};
transfer_to_bicg::Bool=true, atol::T=√eps(T),
rtol::T=√eps(T), itmax::Int=0,
timemax::Float64=Inf, verbose::Int=0, history::Bool=false,
callback=workspace->false, iostream::IO=kstdout)T is an AbstractFloat such as Float32, Float64 or BigFloat. FC is T or Complex{T}.
(x, y, stats) = bilqr(A, b, c, x0::AbstractVector, y0::AbstractVector; kwargs...)BiLQR can be warm-started from initial guesses x0 and y0 where kwargs are the same keyword arguments as above.
Combine BiLQ and QMR to solve adjoint systems.
[0 A] [y] = [b]
[Aᴴ 0] [x] [c]The relation bᴴc ≠ 0 must be satisfied. BiLQ is used for solving primal system Ax = b of size n. QMR is used for solving dual system Aᴴy = c of size n.
Interface
To easily switch between Krylov methods, use the generic interface krylov_solve with method = :bilqr.
For an in-place variant that reuses memory across solves, see bilqr!.
Input arguments
A: a linear operator that models a matrix of dimensionn;b: a vector of lengthn;c: a vector of lengthn.
Optional arguments
x0: a vector of lengthnthat represents an initial guess of the solutionx;y0: a vector of lengthnthat represents an initial guess of the solutiony.
Keyword arguments
transfer_to_bicg: transfer from the BiLQ point to the BiCG point, when it exists. The transfer is based on the residual norm;atol: absolute stopping tolerance based on the residual norm;rtol: relative stopping tolerance based on the residual norm;itmax: the maximum number of iterations. Ifitmax=0, the default number of iterations is set to2n;timemax: the time limit in seconds;verbose: additional details can be displayed if verbose mode is enabled (verbose > 0). Information will be displayed everyverboseiterations;history: collect additional statistics on the run such as residual norms, or Aᴴ-residual norms;callback: function or functor called ascallback(workspace)that returnstrueif the Krylov method should terminate, andfalseotherwise;iostream: stream to which output is logged.
Output arguments
x: a dense vector of lengthn;y: a dense vector of lengthn;stats: statistics collected on the run in anAdjointStatsstructure.
Reference
- A. Montoison and D. Orban, BiLQ: An Iterative Method for Nonsymmetric Linear Systems with a Quasi-Minimum Error Property, SIAM Journal on Matrix Analysis and Applications, 41(3), pp. 1145–1166, 2020.
Krylov.bilqr! — Function
workspace = bilqr!(workspace::BilqrWorkspace, A, b, c; kwargs...)
workspace = bilqr!(workspace::BilqrWorkspace, A, b, c, x0, y0; kwargs...)In these calls, kwargs are keyword arguments of bilqr.
See BilqrWorkspace for instructions on how to create the workspace.
For a more generic interface, you can use krylov_workspace with method = :bilqr to allocate the workspace, and krylov_solve! to run the Krylov method in-place.
Krylov.BilqrWorkspace — Type
Workspace for the in-place methods bilqr! and krylov_solve!.
The following outer constructors can be used to initialize this workspace:
workspace = BilqrWorkspace(m, n, S)
workspace = BilqrWorkspace(A, b)
workspace = BilqrWorkspace(A, b, c)
workspace = BilqrWorkspace(kc::KrylovConstructor{S,S})m and n denote the dimensions of the linear operator A passed to the in-place methods. Since bilqr only supports square linear operators, m and n must be equal. S is the storage type of the vectors in the workspace, such as Vector{Float64}.
KrylovConstructor facilitates the allocation of vectors in the workspace if S(undef, n) is not available.
TriLQR
Krylov.trilqr — Function
(x, y, stats) = trilqr(A, b::AbstractVector{FC}, c::AbstractVector{FC};
transfer_to_usymcg::Bool=true, atol::T=√eps(T),
rtol::T=√eps(T), itmax::Int=0,
timemax::Float64=Inf, verbose::Int=0, history::Bool=false,
callback=workspace->false, iostream::IO=kstdout)T is an AbstractFloat such as Float32, Float64 or BigFloat. FC is T or Complex{T}.
(x, y, stats) = trilqr(A, b, c, x0::AbstractVector, y0::AbstractVector; kwargs...)TriLQR can be warm-started from initial guesses x0 and y0 where kwargs are the same keyword arguments as above.
Combine USYMLQ and USYMQR to solve adjoint systems.
[0 A] [y] = [b]
[Aᴴ 0] [x] [c]USYMLQ is used for solving primal system Ax = b of size m × n. USYMQR is used for solving dual system Aᴴy = c of size n × m.
Interface
To easily switch between Krylov methods, use the generic interface krylov_solve with method = :trilqr.
For an in-place variant that reuses memory across solves, see trilqr!.
Input arguments
A: a linear operator that models a matrix of dimensionm × n;b: a vector of lengthm;c: a vector of lengthn.
Optional arguments
x0: a vector of lengthnthat represents an initial guess of the solutionx;y0: a vector of lengthmthat represents an initial guess of the solutiony.
Keyword arguments
transfer_to_usymcg: transfer from the USYMLQ point to the USYMCG point, when it exists. The transfer is based on the residual norm;atol: absolute stopping tolerance based on the residual norm;rtol: relative stopping tolerance based on the residual norm;itmax: the maximum number of iterations. Ifitmax=0, the default number of iterations is set tom+n;timemax: the time limit in seconds;verbose: additional details can be displayed if verbose mode is enabled (verbose > 0). Information will be displayed everyverboseiterations;history: collect additional statistics on the run such as residual norms, or Aᴴ-residual norms;callback: function or functor called ascallback(workspace)that returnstrueif the Krylov method should terminate, andfalseotherwise;iostream: stream to which output is logged.
Output arguments
x: a dense vector of lengthn;y: a dense vector of lengthm;stats: statistics collected on the run in anAdjointStatsstructure.
Reference
- A. Montoison and D. Orban, BiLQ: An Iterative Method for Nonsymmetric Linear Systems with a Quasi-Minimum Error Property, SIAM Journal on Matrix Analysis and Applications, 41(3), pp. 1145–1166, 2020.
Krylov.trilqr! — Function
workspace = trilqr!(workspace::TrilqrWorkspace, A, b, c; kwargs...)
workspace = trilqr!(workspace::TrilqrWorkspace, A, b, c, x0, y0; kwargs...)In these calls, kwargs are keyword arguments of trilqr.
See TrilqrWorkspace for instructions on how to create the workspace.
For a more generic interface, you can use krylov_workspace with method = :trilqr to allocate the workspace, and krylov_solve! to run the Krylov method in-place.
Krylov.TrilqrWorkspace — Type
Workspace for the in-place methods trilqr! and krylov_solve!.
The following outer constructors can be used to initialize this workspace:
workspace = TrilqrWorkspace(m, n, Sm, Sn)
workspace = TrilqrWorkspace(m, n, S)
workspace = TrilqrWorkspace(A, b)
workspace = TrilqrWorkspace(A, b, c)
workspace = TrilqrWorkspace(kc::KrylovConstructor{Sm,Sn})m and n denote the dimensions of the linear operator A passed to the in-place methods. Since trilqr supports rectangular linear operators, m and n can differ. Sm and Sn are the storage types of the workspace vectors of length m and n, respectively. If the same storage type can be used for both, a single type S may be provided, such as Vector{Float64}.
KrylovConstructor facilitates the allocation of vectors in the workspace if Sm(undef, m) and Sn(undef, n) are not available.