Skip to content

Commit ed62012

Browse files
author
mohamed82008
committed
Update docstrings
1 parent 6f1708e commit ed62012

File tree

1 file changed

+40
-8
lines changed

1 file changed

+40
-8
lines changed

src/lobpcg.jl

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -653,18 +653,18 @@ end
653653
"""
654654
The Locally Optimal Block Preconditioned Conjugate Gradient Method (LOBPCG)
655655
656-
Finds the k extremal eigenvalues and their corresponding eigenvectors satisfying `AX = λBX` returning `λ` and `X`, using `X` as an initial guess, where `k = size(X,2)`. The input `X` is overwritten with the solution.
656+
Finds the `nev` extremal eigenvalues and their corresponding eigenvectors satisfying `AX = λBX`.
657657
658-
`A` and `B` may be generic types but `Base.A_mul_B!(C, AorB, X)` and `AorB * X` must be defined for vectors and strided matrices `X` and `C`.
658+
`A` and `B` may be generic types but `Base.A_mul_B!(C, AorB, X)` must be defined for vectors and strided matrices `X` and `C`. `size(A, i::Int)` and `eltype(A)` must also be defined for `A`.
659659
660-
lobpcg(A, [B,] largest, X0; kwargs...) -> results
660+
lobpcg(A, [B,] largest, nev; kwargs...) -> results
661661
662662
# Arguments
663663
664664
- `A`: linear operator;
665665
- `B`: linear operator;
666666
- `largest`: `true` if largest eigenvalues are desired and false if smallest;
667-
- `X0`: Initial guess, will not be modified. The number of columns is the number of eigenvectors desired.
667+
- `nev`: number of eigenvalues desired.
668668
669669
## Keywords
670670
@@ -683,17 +683,47 @@ Finds the k extremal eigenvalues and their corresponding eigenvectors satisfying
683683
# Output
684684
685685
- `results`: a `LOBPCGResults` struct. `r.λ` and `r.X` store the eigenvalues and eigenvectors.
686-
687686
"""
688-
function lobpcg(A, largest::Bool, X0::Union{AbstractMatrix, AbstractVector}; kwargs...)
689-
lobpcg(A, nothing, largest, X0; kwargs...)
690-
end
691687
function lobpcg(A, largest::Bool, nev::Int=1; kwargs...)
692688
lobpcg(A, nothing, largest, nev; kwargs...)
693689
end
694690
function lobpcg(A, B, largest::Bool, nev::Int=1; kwargs...)
695691
lobpcg(A, B, largest, rand(eltype(A), size(A, 1), nev); not_zeros=true, kwargs...)
696692
end
693+
694+
"""
695+
lobpcg(A, [B,] largest, X0; kwargs...) -> results
696+
697+
# Arguments
698+
699+
- `A`: linear operator;
700+
- `B`: linear operator;
701+
- `largest`: `true` if largest eigenvalues are desired and false if smallest;
702+
- `X0`: Initial guess, will not be modified. The number of columns is the number of eigenvectors desired.
703+
704+
## Keywords
705+
706+
- `not_zeros`: default is `false`. If `true`, `X0` will be assumed to not have any all-zeros column.
707+
708+
- `log::Bool`: default is `false`; if `true`, `results.trace` will store iterations
709+
states; if `false` only `results.trace` will be empty;
710+
711+
- `P`: preconditioner of residual vectors, must overload `A_ldiv_B!`;
712+
713+
- `C`: constraint to deflate the residual and solution vectors orthogonal
714+
to a subspace; must overload `A_mul_B!`;
715+
716+
- `maxiter`: maximum number of iterations; default is 200;
717+
718+
- `tol::Number`: tolerance to which residual vector norms must be under.
719+
720+
# Output
721+
722+
- `results`: a `LOBPCGResults` struct. `r.λ` and `r.X` store the eigenvalues and eigenvectors.
723+
"""
724+
function lobpcg(A, largest::Bool, X0::Union{AbstractMatrix, AbstractVector}; kwargs...)
725+
lobpcg(A, nothing, largest, X0; kwargs...)
726+
end
697727
function lobpcg(A, B, largest, X0;
698728
not_zeros=false, log=false, P=nothing,
699729
C=nothing, tol=nothing, maxiter=200)
@@ -719,6 +749,8 @@ end
719749
720750
## Keywords
721751
752+
- `not_zeros`: default is `false`. If `true`, the initial Ritz vectors will be assumed to not have any all-zeros column.
753+
722754
- `log::Bool`: default is `false`; if `true`, `results.trace` will store iterations
723755
states; if `false` only `results.trace` will be empty;
724756

0 commit comments

Comments
 (0)