(Inverse) power method
Usage
#
IterativeSolvers.powm
— Function
powm(B; kwargs...) -> λ, x, [history]
See powm!
. Calls powm!(B, x0; kwargs...)
with x0
initialized as a random, complex unit vector.
#
IterativeSolvers.powm!
— Function
powm!(B, x; shift = zero(eltype(B)), inverse::Bool = false, kwargs...) -> λ, x, [history]
By default finds the approximate eigenpair (λ, x)
of B
where |λ|
is largest.
Arguments
-
B
: linear map, see the note below. -
x
: normalized initial guess. Don’t forget to use complex arithmetic when necessary.
Keywords
-
tol::Real = eps(real(eltype(B))) * size(B, 2) ^ 3
: stopping tolerance for the residual norm; -
maxiter::Integer = size(B,2)
: maximum number of iterations; -
log::Bool
: keep track of the residual norm in each iteration; -
verbose::Bool
: print convergence information during the iterations.
When applying shift-and-invert to with |
Return values
if log
is false
-
λ::Number
approximate eigenvalue computed as the Rayleigh quotient; -
x::Vector
approximate eigenvector.
if log
is true
-
λ::Number
: approximate eigenvalue computed as the Rayleigh quotient; -
x::Vector
: approximate eigenvector; -
history
: convergence history.
ConvergenceHistory keys
-
:tol
=>::Real
: stopping tolerance; -
:resnom
=>::Vector
: residual norm at each iteration.
Examples
using LinearMaps
σ = 1.0 + 1.3im
A = rand(ComplexF64, 50, 50)
F = lu(A - σ * I)
Fmap = LinearMap{ComplexF64}((y, x) -> ldiv!(y, F, x), 50, ismutating = true)
λ, x = powm(Fmap, inverse = true, shift = σ, tol = 1e-4, maxiter = 200)
#
IterativeSolvers.invpowm
— Function
invpowm(B; shift = σ, kwargs...) -> λ, x, [history]
Find the approximate eigenpair (λ, x)
of near shift
, where B
is a linear map that has the effect B * v = inv(A - σI) * v
.
The method calls powm!(B, x0; inverse = true, shift = σ)
with x0
a random, complex unit vector. See powm!
Examples
using LinearMaps
σ = 1.0 + 1.3im
A = rand(ComplexF64, 50, 50)
F = lu(A - σ * I)
Fmap = LinearMap{ComplexF64}((y, x) -> ldiv!(y, F, x), 50, ismutating = true)
λ, x = invpowm(Fmap, shift = σ, tol = 1e-4, maxiter = 200)
#
IterativeSolvers.invpowm!
— Function
invpowm!(B, x0; shift = σ, kwargs...) -> λ, x, [history]
Find the approximate eigenpair (λ, x)
of near shift
, where B
is a linear map that has the effect B * v = inv(A - σI) * v
.
The method calls powm!(B, x0; inverse = true, shift = σ)
. See powm!
.