Skip to content

Commit

Permalink
An implementation of USYMLQR
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Oct 13, 2024
1 parent 0be5550 commit 3220c16
Show file tree
Hide file tree
Showing 19 changed files with 728 additions and 119 deletions.
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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 @@ -32,6 +32,7 @@ DqgmresSolver
GmresSolver
UsymlqSolver
UsymqrSolver
UsymlqrSolver
TricgSolver
TrimrSolver
TrilqrSolver
Expand Down
27 changes: 27 additions & 0 deletions docs/src/examples/usymlqr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
```@example usymlqr
using Krylov, LinearOperators, LDLFactorizations
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]
llt_D = cholesky(D)
opD⁻¹ = LinearOperator(Float64, 5, 5, true, true, (y, v) -> ldiv!(y, llt_D, v))
opH⁻¹ = BlockDiagonalOperator(opD⁻¹, eye(n))
(x, y, stats) = usymlqr(A, b, c, M=opD⁻¹, sp=true)
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 |

!!! info
GPMR is the only method that requires `A * v` and `B * w` products.
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$ | $Xn + Ym$ |

#### 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
1 change: 1 addition & 0 deletions src/krylov_solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ for (KS, fun, args, def_args, optargs, def_optargs, kwargs, def_kwargs) in [
(: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 )
]
@eval begin
solve!(solver :: $KS{T,FC,S}, $(def_args...); $(def_kwargs...)) where {T <: AbstractFloat, FC <: FloatOrComplex{T}, S <: AbstractVector{FC}} = $(fun)(solver, $(args...); $(kwargs...))
Expand Down
Loading

0 comments on commit 3220c16

Please sign in to comment.