From 3c8e6ebbfd3a1c1ed8851bd84e876e595f3a9145 Mon Sep 17 00:00:00 2001 From: Aidan Gleich <41960733+aidan-cg@users.noreply.github.com> Date: Wed, 25 Aug 2021 15:47:59 -0400 Subject: [PATCH] Add additional constructor for DegenerateMvNormal distribution --- src/distributions_ext.jl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/distributions_ext.jl b/src/distributions_ext.jl index 649cf43..35df9c7 100644 --- a/src/distributions_ext.jl +++ b/src/distributions_ext.jl @@ -143,6 +143,16 @@ function DegenerateMvNormal(μ::Vector, σ::Matrix; stdev::Bool = true) true, σ) end end + +""" +``` +DegenerateMvNormal(μ::Vector, σ::Matrix, σ_inv::Matrix, λ_vals::Vector; stdev::Bool = true)) +``` +Constructor for DegenerateMvNormal type. +""" +function DegenerateMvNormal(μ::Vector, σ::Matrix, σ_inv::Matrix, λ_vals::Vector; stdev::Bool = true) + return DegenerateMvNormal(μ, σ, σ_inv, λ_vals, false, Matrix{eltype(μ)}(undef,0,0)) +end """ ``` function init_deg_mvnormal(μ::Vector, σ::Matrix) @@ -154,7 +164,7 @@ function init_deg_mvnormal(μ::Vector, σ::Matrix; stdev::Bool = true) U, λ_vals, Vt = svd(σ) λ_inv = [λ > 1e-12 ? 1/λ : 0.0 for λ in λ_vals] σ_inv = Vt' * Diagonal(λ_inv) * U' - return DegenerateMvNormal(μ, σ, σ_inv, λ_vals) + return DegenerateMvNormal(μ, σ, σ_inv, λ_vals, false, Matrix{eltype(μ)}(undef,0,0)) else return DegenerateMvNormal(μ, σ, Matrix{eltype(μ)}(undef,0,0), Vector{eltype(μ)}(undef,0), false, Matrix{eltype(μ)}(undef,0,0))