Skip to content

Special functions

Since some atoms are not available in the base language or other packages we have implemented them here.

SymbolicAnalysis.dotsort Method
julia
dotsort(x, y)

Sorts x and y and returns the dot product of the sorted vectors.

Arguments

- `x::AbstractVector`: A vector.
- `y::AbstractVector`: A vector.

source

SymbolicAnalysis.eigsummax Method
julia
eigsummax(m::Symmetric, k)

Returns the sum of the k largest eigenvalues of m.

Arguments

- `m::Symmetric`: A symmetric matrix.
- `k::Int`: The Real of largest eigenvalues to sum.

source

SymbolicAnalysis.eigsummin Method
julia
eigsummin(m::Symmetric, k)

Returns the sum of the k smallest eigenvalues of m.

Arguments

- `m::Symmetric`: A symmetric matrix.
- `k::Int`: The Real of smallest eigenvalues to sum.

source

SymbolicAnalysis.huber Function
julia
huber(x, M=1)

Returns the Huber loss function of x with threshold M.

Arguments

- `x::Real`: A Real.
- `M::Real`: The threshold.

source

SymbolicAnalysis.invprod Method
julia
invprod(x::AbstractVector)

Returns the inverse of the product of the elements of x.

Arguments

- `x::AbstractVector`: A vector.

source

SymbolicAnalysis.lognormcdf Method
julia
lognormcdf(x::Real)

Returns the log of the normal cumulative distribution function of x.

Arguments

- `x::Real`: A Real.

source

SymbolicAnalysis.matrix_frac Method
julia
matrix_frac(x::AbstractVector, P::AbstractMatrix)

Returns the quadratic form x' * P^{-1} * x.

Arguments

- `x::AbstractVector`: A vector.
- `P::AbstractMatrix`: A matrix.

source

SymbolicAnalysis.perspective Method
julia
perspective(f::Function, x, s::Real)

Returns the perspective function s * f(x / s).

Arguments

- `f::Function`: A function.
- `x`: A Real.
- `s::Real`: A positive Real.

source

SymbolicAnalysis.quad_form Method
julia
quad_form(x::AbstractVector, P::AbstractMatrix)

Returns the quadratic form x' * P * x.

Arguments

- `x::AbstractVector`: A vector.
- `P::AbstractMatrix`: A matrix.

source

SymbolicAnalysis.quad_over_lin Method
julia
quad_over_lin(x::Real, y::Real)

Returns the quadratic over linear form x^2 / y.

Arguments

- `x`: A Real or a vector.
- `y::Real`: A positive Real.

source

SymbolicAnalysis.sum_largest Method
julia
sum_largest(x::AbstractMatrix, k)

Returns the sum of the k largest elements of x.

Arguments

- `x::AbstractMatrix`: A matrix.
- `k::Int`: The Real of largest elements to sum.

source

SymbolicAnalysis.sum_smallest Method
julia
sum_smallest(x::AbstractMatrix, k)

Returns the sum of the k smallest elements of x.

Arguments

- `x::AbstractMatrix`: A matrix.
- `k::Int`: The Real of smallest elements to sum.

source

SymbolicAnalysis.trinv Method
julia
trinv(x::AbstractMatrix)

Returns the trace of the inverse of x.

Arguments

- `x::AbstractMatrix`: A matrix.

source

SymbolicAnalysis.tv Method
julia
tv(x::AbstractVector{<:AbstractMatrix})

Returns the total variation of x, defined as sum_{i,j} |x_{k+1}[i,j] - x_k[i,j]|.

Arguments

- `x::AbstractVector`: A vector of matrices.

source

SymbolicAnalysis.tv Method
julia
tv(x::AbstractVector{<:Real})

Returns the total variation of x, defined as sum_i |x_{i+1} - x_i|.

Arguments

- `x::AbstractVector`: A vector.

source

SymbolicAnalysis.affine_map Method
julia
affine_map(f, X, B, Y)
affine_map(f, X, B, Ys)

Affine map, i.e., B + f(X, Y) or B + sum(f(X, Y) for Y in Ys) for a function f where f is a positive linear operator.

Arguments

- `f::Function`: One of the following functions: `conjugation`, `diag`, `tr` and `hadamard_product`.
- `X::Matrix`: A symmetric positive definite matrix.
- `B::Matrix`: A matrix.
- `Y::Matrix`: A matrix.
- `Ys::Vector{<:Matrix}`: A vector of matrices.

source

SymbolicAnalysis.conjugation Method
julia
conjugation(X, B)

Conjugation of a matrix X by a matrix B is defined as B'X*B.

Arguments

- `X::Matrix`: A symmetric positive definite matrix.
- `B::Matrix`: A matrix.

source

SymbolicAnalysis.hadamard_product Method
julia
hadamard_product(X, B)

Hadamard product or element-wise multiplication of a symmetric positive definite matrix X by a positive semi-definite matrix B.

Arguments

- `X::Matrix`: A symmetric positive definite matrix.
- `B::Matrix`: A positive semi-definite matrix.

source

SymbolicAnalysis.log_quad_form Method
julia
log_quad_form(y, X)
log_quad_form(ys, X)

Log of the quadratic form of a symmetric positive definite matrix X and a vector y is defined as log(y'*X*y) or for a vector of vectors ys as log(sum(y'*X*y for y in ys)).

Arguments

- `y::Vector`: A vector of `Number`s or a `Vector` of `Vector`s.
- `X::Matrix`: A symmetric positive definite matrix.

source

SymbolicAnalysis.scalar_mat Function
julia
scalar_mat(X, k=size(X, 1))

Scalar matrix of a symmetric positive definite matrix X is defined as tr(X)*I(k).

Arguments

- `X::Matrix`: A symmetric positive definite matrix.
- `k::Int`: The size of the identity matrix.

source

SymbolicAnalysis.schatten_norm Function
julia
schatten_norm(X, p=2)

Schatten norm of a symmetric positive definite matrix X.

Arguments

- `X::Matrix`: A symmetric positive definite matrix.
- `p::Int`: The p-norm.

source

SymbolicAnalysis.sdivergence Method
julia
sdivergence(X, Y)

Symmetric divergence of two symmetric positive definite matrices X and Y is defined as logdet((X+Y)/2) - 1/2*logdet(X*Y).

Arguments

- `X::Matrix`: A symmetric positive definite matrix.
- `Y::Matrix`: A symmetric positive definite matrix.

source

SymbolicAnalysis.sum_log_eigmax Method
julia
sum_log_eigmax(X, k)
sum_log_eigmax(f, X, k)

Sum of the log of the maximum eigenvalues of a symmetric positive definite matrix X. If a function f is provided, the sum is over f applied to the log of the eigenvalues.

Arguments

- `f::Function`: A function.
- `X::Matrix`: A symmetric positive definite matrix.
- `k::Int`: The number of eigenvalues to consider.

source