-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.jl
33 lines (24 loc) · 977 Bytes
/
util.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import LinearAlgebra: I
import ForneyLab: unsafeMean, unsafePrecision, unsafeCov, eye
import StatsFuns: log2π
function eye(dim)
return Matrix{Float64}(I,dim,dim)
end
function mn(d::ProbabilityDistribution{Univariate, T}) where T<:Union{Gaussian,Gamma}
return ForneyLab.unsafeMean(d)
end
function mn(d::ProbabilityDistribution{Multivariate, T}) where T<:Union{Gaussian,Gamma}
return ForneyLab.unsafeMean(d)
end
function pc(d::ProbabilityDistribution{Univariate, T}) where T<:Union{Gaussian,Gamma}
return ForneyLab.unsafePrecision(d)
end
function pc(d::ProbabilityDistribution{Multivariate, T}) where T<:Union{Gaussian,Gamma}
return ForneyLab.unsafePrecision(d)
end
function cv(d::ProbabilityDistribution{Univariate, T}) where T<:Union{Gaussian,Gamma}
return ForneyLab.unsafeCov(d)
end
function cv(d::ProbabilityDistribution{Multivariate, T}) where T<:Union{Gaussian,Gamma}
return ForneyLab.unsafeCov(d)
end