Functions of matrices
MatrixPolynomials.FuncV
— TypeFuncV{f,T}(s⁻¹Amc, c, s)
Structure for applying the action of a polynomial approximation of the function f
with a matrix argument acting on a vector, i.e. w ← p(A)*v
where p(z) ≈ f(z)
. Various properties of f
may be used, such as shifting and scaling of the argument, to improve convergence and/or accuracy. s⁻¹Amc
is the shifted linear operator $s⁻¹(A-c)$, c
and s
are the shift and scaling, respectively.
MatrixPolynomials.FuncV
— TypeFuncV(f, A, m[, t=1; distribution=:leja, kwargs...])
Create a FuncV
that is used to compute f(t*A)*v
using a polynomial approximation of f
formed using m
interpolation points.
kwargs...
are passed on to spectral_range
which estimates the range over which f
has to be interpolated.
LinearAlgebra.mul!
— Methodmul!(w, funcv::FuncV, v)
Evaluate the action of the matrix polynomial funcv
on v
and store the result in w
.
Spectral ranges and shapes
MatrixPolynomials.spectral_range
— Functionspectral_range(A[; ctol=√ε, verbosity=0])
Estimate the spectral range of the matrix/linear operator A
using ArnoldiMethod.jl. If the spectral range along the real/imaginary axis is smaller than ctol
, it is compressed into a line. Returns a spectral Shape
.
Examples
julia> A = Diagonal(1.0:6)
6×6 Diagonal{Float64,StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}}:
1.0 ⋅ ⋅ ⋅ ⋅ ⋅
⋅ 2.0 ⋅ ⋅ ⋅ ⋅
⋅ ⋅ 3.0 ⋅ ⋅ ⋅
⋅ ⋅ ⋅ 4.0 ⋅ ⋅
⋅ ⋅ ⋅ ⋅ 5.0 ⋅
⋅ ⋅ ⋅ ⋅ ⋅ 6.0
julia> MatrixPolynomials.spectral_range(A, verbosity=2)
Converged: 1 of 1 eigenvalues in 6 matrix-vector products
Converged: 1 of 1 eigenvalues in 6 matrix-vector products
Converged: 1 of 1 eigenvalues in 6 matrix-vector products
Converged: 1 of 1 eigenvalues in 6 matrix-vector products
[ Info: Imaginary extent of spectral range 0.0 below tolerance 1.4901161193847656e-8, conflating.
[ Info: 0.0 below tolerance 1.4901161193847656e-8, truncating.
[ Info: 0.0 below tolerance 1.4901161193847656e-8, truncating.
MatrixPolynomials.Line{Float64}(0.9999999999999998 + 0.0im, 6.0 + 0.0im)
julia> MatrixPolynomials.spectral_range(exp(im*π/4)*A, verbosity=2)
Converged: 1 of 1 eigenvalues in 6 matrix-vector products
Converged: 1 of 1 eigenvalues in 6 matrix-vector products
Converged: 1 of 1 eigenvalues in 6 matrix-vector products
Converged: 1 of 1 eigenvalues in 6 matrix-vector products
MatrixPolynomials.Rectangle{Float64}(0.7071067811865468 + 0.7071067811865478im, 4.242640687119288 + 4.242640687119283im)
The second example should also be a Line
, but the algorithm is not yet clever enough.
spectral_range(t, A)
Finds the spectral range of t*A
; if t
is a vector, find the largest such range.
MatrixPolynomials.hermitian_spectral_range
— Functionhermitian_spectral_range(A;[ K=20])
Estimate the spectral range of a Hermitian operator A
using Algorithm 1 of
- Zhou, Y., & Li, R. (2011). Bounding the spectrum of large hermitian matrices. Linear Algebra and its Applications, 435(3), 480–493. http://dx.doi.org/10.1016/j.laa.2010.06.034
Shapes
The shapes in the complex plane are mainly used to generate suitable distributions of Leja points, which are in turn used to generate Newton polynomials that efficiently approximate various functions on the field-of-values of a matrix $\mat{A}$ which is contained within the spectral shape.
MatrixPolynomials.Shape
— TypeShape
Abstract base type for different shapes in the complex plane encircling the spectra of linear operators.
Lines
MatrixPolynomials.Line
— TypeLine(a, b)
For spectra falling on a line in the complex plane from a
to b
.
Base.:*
— Methodn * l::Line
Scale the Line
l
by n
.
Base.range
— Methodrange(l::Line, n)
Generate a uniform distribution of n
values along the Line
l
. If the line is on the real axis, the resulting values will be real as well.
Examples
julia> range(MatrixPolynomials.Line(0, 1.0im), 5)
5-element LinRange{Complex{Float64}}:
0.0+0.0im,0.0+0.25im,0.0+0.5im,0.0+0.75im,0.0+1.0im
julia> range(MatrixPolynomials.Line(0, 1.0), 5)
0.0:0.25:1.0
Statistics.mean
— Methodmean(l::Line)
Return the mean value along the Line
l
.
Base.union
— Methoda::Line ∪ b::Line
Form the union of the Line
s a
and b
, which need to be collinear.
Rectangles
MatrixPolynomials.Rectangle
— TypeRectangle(a,b)
For spectra falling within a rectangle in the complex plane with corners a
and b
.
Base.:*
— Methodn * r::Rectangle
Scale the Rectangle
r
by n
.
Base.range
— Methodrange(r::Rectangle, n)
Generate a uniform distribution of n
values along the diagonal of the Rectangle
r
.
This assumes that the eigenvalues lie on the diagonal of the rectangle, i.e. that the spread is negligible. It would be more correct to instead generate samples along the sides of the rectangle, however, spectral_range
needs to be modified to correctly identify spectral ranges falling on a line that is not lying on the real or imaginary axis.
Statistics.mean
— Methodmean(r::Rectangle)
Return the middle value of the Rectangle
r
.
Base.union
— Methoda::Rectangle ∪ b::Rectangle
Find the smalling Rectangle
encompassing a
and b
.