Skip to content

Commit

Permalink
Add additional constructor for DegenerateMvNormal distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
aidan-cg committed Aug 25, 2021
1 parent 47aab0c commit 3c8e6eb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/distributions_ext.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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))
Expand Down

0 comments on commit 3c8e6eb

Please sign in to comment.