-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprimitive.jl
31 lines (20 loc) · 945 Bytes
/
primitive.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
export PrimitiveMeasure
"""
abstract type PrimitiveMeasure <: AbstractMeasure end
In the MeasureTheory ecosystem, a _primitive_ measure is a measure for which the
definition and construction do not depend on any other measure. Primitive
measures satisfy the following laws:
basemeasure(μ::PrimitiveMeasure) = μ
logdensity_def(μ::PrimitiveMeasure, x) = 0.0
logdensity_def(μ::M, ν::M, x) where {M<:PrimitiveMeasure} = 0.0
"""
abstract type PrimitiveMeasure <: AbstractMeasure end
basemeasure(μ::PrimitiveMeasure) = μ
@inline basemeasure_depth(::PrimitiveMeasure) = static(0)
@inline strict_logdensityof(::PrimitiveMeasure, x::Real) = zero(float(typeof(x)))
@inline strict_logdensityof(::PrimitiveMeasure, x) = false
logdensity_def(::PrimitiveMeasure, x) = static(0.0)
logdensity_def(μ::M, ν::M, x) where {M<:PrimitiveMeasure} = 0.0
function Pretty.quoteof(μ::M) where {M<:PrimitiveMeasure}
:($M())
end