In REPL, type either
] add ArnoldiMethodTransformations or
using Pkg Pkg.add("ArnoldiMethodTransformations")
This package mainly extends some methods of ArnoldiMethod, which needs to be separately installed.
It exports three constants:
MSOLVER, used to indicate whether to use UMFPACK, Pardiso, or MUMPS.
Ordinary eigenvalue problem
using LinearAlgebra using ArnoldiMethod using ArnoldiMethodTransformations # construct fixed eval matrix in random basis D = diagm(0=>[0,1,2,3,4,5,6,7,8,9]) S = randn(10,10) A = S\D*S # find eigenpairs closest to 5.001 (cannot be 5 as algorithm is unstable if σ is exactly an eval) σ = 5.001 decomp, hist = partialschur(A,σ) # get evecs λ, v = partialeigen(decomp,σ) display(λ) norm(A*v-v*diagm(0=>λ)) # should be ~1e-11 or smaller
Generalized eigenvalue problem
using LinearAlgebra using ArnoldiMethod using ArnoldiMethodTransformations # construct fixed eval matrix in random basis A = rand(ComplexF64,10,10) B = rand(ComplexF64,10,10) # find eigenpairs closest to .5 σ = .5 decomp, hist = partialschur(A,B,σ) # get evecs λ, v = partialeigen(decomp,σ) display(λ) norm(A*v-B*v*diagm(0=>λ)) # should be ~1e-14 or smaller
Note that in both cases,
ArnoldiMethod needed to be explicitly brought into scope with
This package exports none of its own methods, but extends
partialeigen from ArnoldiMethod.
It does export three constants:
`partialschur(A, [B], σ; [diag_inv_B, lupack=USOLVER, kwargs...]) -> decomp, history`
Partial Schur decomposition of
A, with shift
σ and mass matrix
A*v=(λ-σ)*B*v for its smallest eigenvalues.
diag_inv_B defaults to
B is both diagonal and invertible. This enables
a simplified shift-and-invert scheme.
lupack determines what linear algebra library to use. Options are
USOLVER (UMFPACK, the default),
PSOLVER (Pardiso), and the default
The relevant solver must be explicitly loaded at the top level to use it (e.g.,
using Pardiso must be called before
lupack=PSOLVER can be used).
For other keywords, see
partialeigen(decomp, σ) -> λ, v
Transforms a partial Schur decomposition into an eigendecomposition, outputting evals
λ and evecs
It undoes the shift-and-invert of the eigenvalues by
Note that the shifting to an exact eigenvalue poses a problem, see note on purification.
Pardiso is often faster, and uses significantly less memory, but require separate installation, which not all users will want to do. This optional dependency is implemented with Requires.jl.
The default solver is UMFPACK. To use another solver, such as Pardiso (assuming it is installed), use the keyword
To do: add MUMPS to the available solvers.