MarkovKernels.jl aims to support a wide variety of parametrizations of positive semi-definite matrices. How this is accomplished is explaiend in the following.
Types
Currently, the following types are valid PSD parametrizations (in the sense, the PSDParametriszations methods below have been implemented):
Real
SelfAdjoint
Cholesky
Here, the definition of SelfAdjoint
is:
const RealSymmetric{T,S} = Symmetric{T,S} where {T<:Real,S}
const ComplexHermitian{T,S} = Hermitian{T,S} where {T<:Complex,S}
const RealDiagonal{T,S} = Diagonal{T,S} where {T<:Real,S}
const SelfAdjoint{T,S} =
Union{RealSymmetric{T,S},ComplexHermitian{T,S},RealDiagonal{T,S}} where {T,S}
PSD Trait
In order to determine, whether a type is a PSDParametrization
the following types are defined:
abstract type PSDTrait end
struct IsPSD <: PSDTrait end
struct IsNotPSD <: PSDTrait end
A custom typer can opt into being a PSDparametrization
by implementing
psdcheck(::MyPSDType) = IsPSD()
which is a promise that the methods of the next section have been implemented.
PSDParametrizations methods
MarkovKernels.psdcheck
— Methodpsdcheck(A)
Returns IsPSD() if A is a PSDParametrization otherwise IsNotPSD()
MarkovKernels.convert_psd_eltype
— Methodconvert_psd_eltype(::Type{T}, P)
Wraps P in a psd paramtrization of eltype T. If P is already a type of psd paramtrization, then just the eltype is converted.
MarkovKernels.rsqrt
— Methodrsqrt(Σ)
Computes a right square-root of Σ.
MarkovKernels.lsqrt
— Methodlsqrt(Σ)
Computes a left square-root of Σ.
MarkovKernels.stein
— Methodstein(Σ, Φ, [Q])
Computes the output of the stein operator
Σ ↦ Φ * Σ * Φ' + Q.
MarkovKernels.schur_reduce
— Methodschur_reduce(Π, C, [R])
Computes the tuple (S, K, Σ) associated with the following (block) Schur reduction:
[C*Π*C'+R C*Π; Π*C' Π] = [0 0; 0 Σ] + [I; K]*(C*Π*C' + R)*[I; K]'
In terms of Kalman filtering, Π is the predictive covariance, C the measurement matrix, and R the measurement covariance, then S is the marginal measurement covariance, K is the Kalman gain, and Σ is the filtering covariance.
SelfAdjoint methods
Additionally, the following methods are defined for SelfAdjoint
:
MarkovKernels.selfadjoint!
— Methodselfadjoint!(A)
Computes the self-adjoint part of A, in-place, and wraps it in an appropriate self-adjoint wrapper type (i.e. Symemtric / Hermitian).
MarkovKernels.selfadjoint
— Methodselfadjoint(A)
Computes the self-adjoint part of A and wraps it in an appropriate self-adjoint wrapper type (i.e. Symemtric / Hermitian).