Skip to content

Commit

Permalink
Fix a few details...
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Oct 14, 2024
1 parent 83a3181 commit 255c79e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions docs/src/solvers/ls.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
```@docs
cgls
cgls!
```

## CGLS-LANCZOS-SHIFT

```@docs
cgls_lanczos_shift
cgls_lanczos_shift!
```
Expand Down
4 changes: 2 additions & 2 deletions docs/src/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ Each table summarizes the storage requirements of Krylov methods recommended to
#### Least-squares problems

| Methods | [`USYMQR`](@ref usymqr) | [`CGLS`](@ref cgls) | [`CG-LANCZOS-SHIFT`](@ref cg_lanczos_shift) | [`CRLS`](@ref crls) | [`LSLQ`](@ref lslq) | [`LSQR`](@ref lsqr) | [`LSMR`](@ref lsmr) |
|:-------:|:-----------------------:|:-------------------:|:-------------------:|:-------------------:|:-------------------:|:-------------------:|
| Storage | $6n + 3m$ | $3n + 2m$ | $3n + 2m + 5p + 2np$ | $4n + 3m$ | $4n + 2m$ | $4n + 2m$ | $5n + 2m$ |
|:-------:|:-----------------------:|:-------------------:|:-------------------------------------------:|:-------------------:|:-------------------:|:-------------------:|
| Storage | $6n + 3m$ | $3n + 2m$ | $3n + 2m + 5p + 2np$ | $4n + 3m$ | $4n + 2m$ | $4n + 2m$ | $5n + 2m$ |

#### Adjoint systems

Expand Down
2 changes: 1 addition & 1 deletion src/cg_lanczos_shift.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ of size n. The method does _not_ abort if A + αI is not definite.
function cg_lanczos_shift end

"""
solver = cg_lanczos!(solver::CgLanczosShiftSolver, A, b, shifts; kwargs...)
solver = cg_lanczos_shift!(solver::CgLanczosShiftSolver, A, b, shifts; kwargs...)
where `kwargs` are keyword arguments of [`cg_lanczos_shift`](@ref).
Expand Down
10 changes: 5 additions & 5 deletions src/cgls_lanczos_shift.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ but simpler to implement.
function cgls_lanczos_shift end

"""
solver = cgls_lanczos_shift!(solver::CglsLanczosShiftSolver, A, b; kwargs...)
solver = cgls_lanczos_shift!(solver::CglsLanczosShiftSolver, A, b, shifts; kwargs...)
where `kwargs` are keyword arguments of [`cgls_lanczos_shift`](@ref).
See [`CglsLanczosShiftSolver`](@ref) for more details about the `solver`.
"""
function cgls_lanczos_shift! end
Expand All @@ -89,7 +91,7 @@ def_kwargs_cgls_lanczos_shift = (:(; M = I ),
:(; callback = solver -> false ),
:(; iostream::IO = kstdout ))

def_kwargs_cgls_lanczos_shift = mapreduce(extract_parameters, vcat, def_kwargs_cgls_lanczos_shift)
def_kwargs_cgls_lanczos_shift = extract_parameters.(def_kwargs_cgls_lanczos_shift)

args_cgls_lanczos_shift = (:A, :b, :shifts)
kwargs_cgls_lanczos_shift = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax, :timemax, :verbose, :history, :callback, :iostream)
Expand All @@ -111,9 +113,7 @@ kwargs_cgls_lanczos_shift = (:M, :ldiv, :check_curvature, :atol, :rtol, :itmax,

# Tests M = Iₙ
MisI = (M === I)
if !MisI
@warn "Preconditioner not implemented"
end
!MisI && error("Preconditioner `M` is not supported.")

# Check type consistency
eltype(A) == FC || @warn "eltype(A) ≠ $FC. This could lead to errors or additional allocations in operator-vector products."
Expand Down

0 comments on commit 255c79e

Please sign in to comment.