Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an implementation of USYMLQR #886

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ makedocs(
"MINARES" => "examples/minares.md",
"TriCG" => "examples/tricg.md",
"TriMR" => "examples/trimr.md",
"USYMLQR" => "examples/usymlqr.md",
"BICGSTAB" => "examples/bicgstab.md",
"DQGMRES" => "examples/dqgmres.md",
"BLOCK-GMRES" => "examples/block_gmres.md",
Expand Down
1 change: 1 addition & 0 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ DqgmresSolver
GmresSolver
UsymlqSolver
UsymqrSolver
UsymlqrSolver
TricgSolver
TrimrSolver
TrilqrSolver
Expand Down
25 changes: 25 additions & 0 deletions docs/src/examples/usymlqr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
```@example usymlqr
using Krylov, LinearOperators
using LinearAlgebra, Printf, SparseArrays

# Identity matrix.
eye(n::Int) = sparse(1.0 * I, n, n)

# Saddle-point systems
n = m = 5
A = [2^(i/j)*j + (-1)^(i-j) * n*(i-1) for i = 1:n, j = 1:n]
b = ones(n)
D = diagm(0 => [2.0 * i for i = 1:n])
m, n = size(A)
c = -b

# [D A] [x] = [b]
# [Aᴴ 0] [y] [c]
opH = BlockDiagonalOperator(inv(D), eye(n))
(x, y, stats) = usymlqr(A, b, c, M=inv(D))
K = [D A; A' zeros(n,n)]
B = [b; c]
r = B - K * [x; y]
resid = sqrt(dot(r, opH * r))
@printf("USYMLQR: Relative residual: %8.1e\n", resid)
```
2 changes: 1 addition & 1 deletion docs/src/matrix_free.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Some methods only require `A * v` products, whereas other ones also require `A'
| CG, CR, CAR | CGLS, CRLS, CGNE, CRMR |
| SYMMLQ, CG-LANCZOS, MINRES, MINRES-QLP, MINARES | LSLQ, LSQR, LSMR, LNLQ, CRAIG, CRAIGMR |
| DIOM, FOM, DQGMRES, GMRES, FGMRES, BLOCK-GMRES | BiLQ, QMR, BiLQR, USYMLQ, USYMQR, TriLQR |
| CGS, BICGSTAB | TriCG, TriMR |
| CGS, BICGSTAB | TriCG, TriMR, USYMLQR |
| CG-LANCZOS-SHIFT | CGLS-LANCZOS-SHIFT |

!!! info
Expand Down
2 changes: 1 addition & 1 deletion docs/src/preconditioners.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Methods concerned: [`CGNE`](@ref cgne), [`CRMR`](@ref crmr), [`LNLQ`](@ref lnlq)

### Saddle-point and symmetric quasi-definite systems

[`TriCG`](@ref tricg) and [`TriMR`](@ref trimr) can take advantage of the structure of Hermitian systems $Kz = d$ with the 2x2 block structure
[`TriCG`](@ref tricg), [`TriMR`](@ref trimr) and [`USYMLQR`](@ref usymlqr) can take advantage of the structure of Hermitian systems $Kz = d$ with the 2x2 block structure
```math
\begin{bmatrix} \tau E & \phantom{-}A \\ A^H & \nu F \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} b \\ c \end{bmatrix},
```
Expand Down
2 changes: 1 addition & 1 deletion docs/src/processes.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ T_{k,k+1} =

The function [`saunders_simon_yip`](@ref saunders_simon_yip(::Any, ::AbstractVector{FC}, ::AbstractVector{FC}, ::Int) where FC <: (Union{Complex{T}, T} where T <: AbstractFloat)) returns $V_{k+1}$, $\beta_1$, $T_{k+1,k}$, $U_{k+1}$, $\bar{\gamma}_1$ and $T_{k,k+1}^H$.

Related methods: [`USYMLQ`](@ref usymlq), [`USYMQR`](@ref usymqr), [`TriLQR`](@ref trilqr), [`TriCG`](@ref tricg) and [`TriMR`](@ref trimr).
Related methods: [`USYMLQ`](@ref usymlq), [`USYMQR`](@ref usymqr), [`USYMLQR`](@ref usymlqr), [`TriLQR`](@ref trilqr), [`TriCG`](@ref tricg) and [`TriMR`](@ref trimr).

!!! note
The Saunders-Simon-Yip is equivalent to the block-Lanczos process applied to $\begin{bmatrix} 0 & A \\ A^H & 0 \end{bmatrix}$ with initial matrix $\begin{bmatrix} b & 0 \\ 0 & c \end{bmatrix}$.
Expand Down
7 changes: 7 additions & 0 deletions docs/src/solvers/sp_sqd.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ tricg!
trimr
trimr!
```

## USYMLQR

```@docs
usymlqr!
usymlqr
```
6 changes: 3 additions & 3 deletions docs/src/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ Each table summarizes the storage requirements of Krylov methods recommended to

#### Saddle-point and Hermitian quasi-definite systems

| Methods | [`TriCG`](@ref tricg) | [`TriMR`](@ref trimr) |
|:--------:|:---------------------:|:---------------------:|
| Storage | $6n + 6m$ | $8n + 8m$ |
| Methods | [`TriCG`](@ref tricg) | [`TriMR`](@ref trimr) | [`USYMLQR`](@ref usymlqr) |
|:--------:|:---------------------:|:---------------------:|:-------------------------:|
| Storage | $6n + 6m$ | $8n + 8m$ | $7n + 6m$ |

#### Generalized saddle-point and non-Hermitian partitioned systems

Expand Down
1 change: 1 addition & 0 deletions src/Krylov.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ include("gpmr.jl")

include("usymlq.jl")
include("usymqr.jl")
include("usymlqr.jl")
include("tricg.jl")
include("trimr.jl")
include("trilqr.jl")
Expand Down
12 changes: 6 additions & 6 deletions src/block_krylov_solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ const BLOCK_KRYLOV_SOLVERS = Dict(:block_minres => :BlockMinresSolver,
abstract type BlockKrylovSolver{T,FC,SV,SM} end

"""
Type for storing the vectors required by the in-place version of BLOCK-MINRES.
Workspace for the in-place version of BLOCK-MINRES.

The outer constructors
The outer constructors:

solver = BlockMinresSolver(m, n, p, SV, SM)
solver = BlockMinresSolver(A, B)

may be used in order to create these vectors.
can be used to initialize this workspace.
`memory` is set to `div(n,p)` if the value given is larger than `div(n,p)`.
"""
mutable struct BlockMinresSolver{T,FC,SV,SM} <: BlockKrylovSolver{T,FC,SV,SM}
Expand Down Expand Up @@ -76,14 +76,14 @@ function BlockMinresSolver(A, B)
end

"""
Type for storing the vectors required by the in-place version of BLOCK-GMRES.
Workspace for the in-place version of BLOCK-GMRES.

The outer constructors
The outer constructors:

solver = BlockGmresSolver(m, n, p, memory, SV, SM)
solver = BlockGmresSolver(A, B, memory = 5)

may be used in order to create these vectors.
can be used to initialize this workspace.
`memory` is set to `div(n,p)` if the value given is larger than `div(n,p)`.
`memory` is an optional argument in the second constructor.
"""
Expand Down
1 change: 1 addition & 0 deletions src/krylov_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ for (workspace, krylov, args, def_args, optargs, def_optargs, kwargs, def_kwargs
(:FgmresSolver , :fgmres , args_fgmres , def_args_fgmres , optargs_fgmres , def_optargs_fgmres , kwargs_fgmres , def_kwargs_fgmres )
(:FomSolver , :fom , args_fom , def_args_fom , optargs_fom , def_optargs_fom , kwargs_fom , def_kwargs_fom )
(:GpmrSolver , :gpmr , args_gpmr , def_args_gpmr , optargs_gpmr , def_optargs_gpmr , kwargs_gpmr , def_kwargs_gpmr )
(:UsymlqrSolver , :usymlqr , args_usymlqr , def_args_usymlqr , optargs_usymlqr , def_optargs_usymlqr , kwargs_usymlqr , def_kwargs_usymlqr )
(:CgLanczosShiftSolver , :cg_lanczos_shift , args_cg_lanczos_shift , def_args_cg_lanczos_shift , (), (), kwargs_cg_lanczos_shift , def_kwargs_cg_lanczos_shift )
(:CglsLanczosShiftSolver, :cgls_lanczos_shift, args_cgls_lanczos_shift, def_args_cgls_lanczos_shift, (), (), kwargs_cgls_lanczos_shift, def_kwargs_cgls_lanczos_shift)
]
Expand Down
Loading
Loading