Matrix Functions API
Matrix-variable functions f(A::AbstractMatrix)::AbstractMatrix
MatrixFuns.mat_fun
— Functionmat_fun(f, A; scale, sep, max_deg, color, ε, checknative)
Compute the matrix-variable function f(A)
. Return a matrix.
f
a general scalar function, and called as f(x)
.
A
an arbitrary square matrix.
scale
the scaling of the Talyor series error, is used to control the spread of each splitting cluster. By default, scale = 1
.
sep
the initial separation distance, to split the eigenvalues of A
into clusters that satisfy (i) min{|λ - μ|: λ ∈ clp, μ ∈ clq, p ≠ q} > sep. (ii) for clp with |clp| > 1, ∀ λ ∈ clp, ∃ μ ∈ clp and μ ≠ λ, s.t. |λ - μ| ≤ sep. Here cl_p is the cluster with index p. By default, sep = 0.1*scale
.
max_deg
the maximum Taylor series order for the diagonal blocks computation.
color(x::Number)::Integer
an index mapping function. This is to ensure all eigenvalues within a cluster have the same color index. By default, the color
function maps x
to 1
. For discontinuous functions, users can assign a distinct color to each continuous interval. E.g., for the sign
function, users can customize the color mapping using color = x -> Int(real(sign(x)))
ε
the target accuracy, set to machine accuracy by default.
checknative
check f
is a Julia native function.
Divided Differences of f(x::Real)::Number
MatrixFuns.div_diff
— Functiondiv_diff(f, x::AbstractVector; kwargs...)
div_diff(f, x::Tuple; kwargs...)
div_diff(f, x...; kwargs...)
Return the divided difference f[x_0,x_1,...,x_n]
, assuming f
is called as f(x)
. See mat_fun
for a description of possible keyword arguments.
Fréchet derivatives of f(A::AbstractMatrix)::AbstractMatrix
MatrixFuns.mat_fun_frechet
— Functionmat_fun_frechet(f, H::AbstractMatrix, h::Vector{AbstractMatrix}; kwargs...)
mat_fun_frechet(DD_F, Ψ::AbstractMatrix, h::Vector{AbstractMatrix})
Return the n-th order Fréchet derivative d^nf(H)h[1]…h[n]
, assuming f
is called as f(x)
. See mat_fun
for a description of possible keyword arguments.
Implementation details
MatrixFuns.get_splittings
— FunctionConstruct the splitting cluster assignments vector z (z_i is the index of the splitting cluster for the i-th data points (eigenvalues)).
MatrixFuns.split_cluster
— FunctionSplit the same color mapping index into one cluster
MatrixFuns.split_by_sep
— Functionsplit_by_sep(pts::AbstractVector{<:Real}, δ::Real)
split_by_sep(pts::AbstractVector{<:Complex}, δ::Real)
Split the data points (eigenvalues) by separation parameter δ.
MatrixFuns.get_spread
— FunctionFind the spread of the data points (eigenvalues).
MatrixFuns.checkspread
— FunctionCheck that the spread error is smaller than the splitting error.
MatrixFuns.reorder_schur
— FunctionReorder the Schur decomposition using ordschur!
.
MatrixFuns.get_swappings
— FunctionFind the swap strategy that converts an integer sequence into a confluent sequence that the repeated indexes are next to each other. E.g., (1,4,2,1,2,3,3,2) -> (1,1,4,2,2,3,3,2) -> (2,2,2,1,1,4,3,3)
MatrixFuns.atomic_block_fun!
— Functionatomic_block_fun!(f, F, A; max_deg, tol_taylor, checknative)
Implement the atomic block computation f(A)
, and overwriting the values of F
.
max_deg
the maximum Taylor series order for the diagonal blocks computation.
tol_taylor
the termination tolerance for evaluating the Taylor series of diagonal blocks.
checknative
check f
is a Julia native function.
MatrixFuns.atomic_block_fun
— Functionatomic_block_fun(f, A; kwargs...)
Implement the atomic block computation f(A)
.
MatrixFuns.taylor_coeffs
— Functiontaylor_coeffs(f, x0, ordr, ordl::Integer=0)
Compute Taylor coefficients of f
at x0
for orders from ordl
to ordr
.
MatrixFuns.parlett_recurrence
— FunctionImplement the standard Parlett recurrence. This is for the case where all eigenvalues are separated from each other.
MatrixFuns.block_parlett_recurrence
— FunctionImplement the block Parlett recurrence. This is for the case where there are eigenvalues are close.
MatrixFuns.DD_tensor
— FunctionGenerate the divided difference tensor (DD_F)_{i_0,...,i_n} = f[λ_{i_0},..., λ_{i_n}]
. By the permutation symmetry of the divided difference, only need to calculate the irreducible vals.