Skip to content

Commit bb3f1af

Browse files
authored
AbstractMeasure (#79)
* AbstractMeasure * add test to interface
1 parent 5a1e0d6 commit bb3f1af

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/MeasureBase.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,19 @@ export logdensity_def
3838
export basemeasure
3939
export basekernel
4040
export productmeasure
41+
42+
"""
43+
inssupport(m, x)
44+
insupport(m)
45+
46+
`insupport(m,x)` computes whether `x` is in the support of `m`.
47+
48+
`insupport(m)` returns a function, and satisfies
49+
50+
insupport(m)(x) == insupport(m, x)
51+
"""
52+
function insupport end
53+
4154
export insupport
4255
export getdof
4356
export transport_to
@@ -46,6 +59,8 @@ include("insupport.jl")
4659

4760
abstract type AbstractMeasure end
4861

62+
AbstractMeasure(m::AbstractMeasure) = m
63+
4964
using Static: @constprop
5065

5166
function Pretty.quoteof(d::M) where {M<:AbstractMeasure}

src/interface.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ function test_interface(μ::M) where {M}
3838
@testset "" begin
3939
μ = $μ
4040

41+
@test AbstractMeasure(μ) isa AbstractMeasure
42+
4143
###########################################################################
4244
# basemeasure_depth
4345
static_depth = @inferred basemeasure_depth(μ)

0 commit comments

Comments
 (0)