Linear Maps
The construction of GMRFs involves various kinds of structured matrices. These structures may be leveraged in downstream computations to save compute and memory. But to make this possible, we need to actually keep track of these structures - which we achieve through diverse subtypes of LinearMap.
GaussianMarkovRandomFields.SymmetricBlockTridiagonalMap Type
SymmetricBlockTridiagonalMap(
diagonal_blocks::Tuple{LinearMap{T},Vararg{LinearMap{T},ND}},
off_diagonal_blocks::Tuple{LinearMap{T},Vararg{LinearMap{T},NOD}},
)
A linear map representing a symmetric block tridiagonal matrix with diagonal blocks diagonal_blocks
and lower off-diagonal blocks off_diagonal_blocks
.
GaussianMarkovRandomFields.SSMBidiagonalMap Type
SSMBidiagonalMap{T}(
A::LinearMap{T},
B::LinearMap{T},
C::LinearMap{T},
N_t::Int,
)
Represents the block-bidiagonal map given by the (N_t) x (N_t - 1) sized block structure:
which occurs as a square root in the discretization of GMRF-based state-space models. N_t
is the total number of blocks along the rows.
GaussianMarkovRandomFields.OuterProductMap Type
OuterProductMap{T}(
A::LinearMap{T},
Q::LinearMap{T},
)
Represents the outer product A' Q A, without actually forming it in memory.
sourceGaussianMarkovRandomFields.LinearMapWithSqrt Type
LinearMapWithSqrt{T}(
A::LinearMap{T},
A_sqrt::LinearMap{T},
)
A symmetric positive definite linear map A
with known square root A_sqrt
, i.e. A = A_sqrt * A_sqrt'
. Behaves just like A
, but taking the square root directly returns A_sqrt
.
Arguments
A::LinearMap{T}
: The linear mapA
.A_sqrt::LinearMap{T}
: The square root ofA
.
GaussianMarkovRandomFields.CholeskySqrt Function
CholeskySqrt(cho::Union{Cholesky{T},SparseArrays.CHOLMOD.Factor{T}})
A linear map representing the square root obtained from a Cholesky factorization, i.e. for A = L * L'
, this map represents L
.
Arguments
cho::Union{Cholesky{T},SparseArrays.CHOLMOD.Factor{T}}
: The Cholesky factorization of a symmetric positive definite matrix.
GaussianMarkovRandomFields.CholeskyFactorizedMap Type
CholeskyFactorizedMap{T,C}(cho::C) where {T,C}
A linear map represented in terms of its Cholesky factorization, i.e. for A = L * L'
, this map represents A
.
Type Parameters
T
: Element type of the matrixC
: Type of the Cholesky factorization
Arguments
cho
: The Cholesky factorization of a symmetric positive definite matrix. Can beCholesky
,SparseArrays.CHOLMOD.Factor
, orLDLFactorization
.
GaussianMarkovRandomFields.ZeroMap Type
ZeroMap{T}(N::Int, M::Int)
A linear map that maps all vectors to the zero vector.
Arguments
N::Int
: Output dimensionM::Int
: Input dimension
GaussianMarkovRandomFields.ADJacobianMap Type
ADJacobianMap(f::Function, x₀::AbstractVector{T}, N_outputs::Int)
A linear map representing the Jacobian of f
at x₀
. Uses forward-mode AD in a matrix-free way, i.e. we do not actually store the Jacobian in memory and only compute JVPs.
Requires ForwardDiff.jl!
Arguments
f::Function
: Function to differentiate.x₀::AbstractVector{T}
: Input vector at which to evaluate the Jacobian.N_outputs::Int
: Output dimension off
.
GaussianMarkovRandomFields.ADJacobianAdjointMap Type
ADJacobianAdjointMap{T}(f::Function, x₀::AbstractVector{T}, N_outputs::Int)
A linear map representing the adjoint of the Jacobian of f
at x₀
. Uses reverse-mode AD in a matrix-free way, i.e. we do not actually store the Jacobian in memory and only compute VJPs.
Requires Zygote.jl!
Arguments
f::Function
: Function to differentiate.x₀::AbstractVector{T}
: Input vector at which to evaluate the Jacobian.N_outputs::Int
: Output dimension off
.