Skip to content

Commit

Permalink
STASH bindkernel and boundmeasure
Browse files Browse the repository at this point in the history
  • Loading branch information
oschulz committed Sep 9, 2024
1 parent 8dbdc52 commit 56157f9
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/combinators/bind.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ b = rand(β_a)
ab = f_c(a, b)
```
The measure `α` that went into the bind can be retrieved via
`boundmeasure(mbind(f_β, α, ...)) == α`.
`mbind(f_β, α, f_c)` is equivalent to `mbind(mkernel(f_β, f_c), α)`
(see [`mkernel`](@ref)) with
`bindkernel(mbind(mkernel(f_β, f_c), α)) == mbind(mkernel(f_β, f_c)`.
Densities on hierarchical measures can only be evaluated if `ab = f_c(a, b)`
can be unambiguously split into `a` and `b` again, knowing `α`. This is
currently implemented for `f_c` that is either tuple or `=>`/`Pair` (these
Expand Down Expand Up @@ -177,6 +184,33 @@ end
# ToDo: Store MKernel in Bind instead of separate fields f_β and f_c?


"""
bindkernel(μ::Bind)::MKernel
Returns the monatic transition kernel of a monatic bind, so that
`bindkernel(mbind(f_k::MKernel, α)) == f_k`.
See [`mbind`](@ref) and [`mkernel`](@ref) for details.
"""
function bindkernel end
export bindkernel

bindkernel::Bind) = mkernel.f_β, μ.f_c)


"""
boundmeasure(μ::Bind)::MKernel
Returns the measure that went into a monatic bind, so that
`boundmeasure(mbind(f_k, α)) == α`.
See [`mbind`](@ref) and [`mkernel`](@ref) for details.
"""
function boundmeasure end
export boundmeasure

boundmeasure::Bind) = mkernel.f_β, μ.f_c)


"""
MeasureBase.transportmeasure(μ::Bind, x)::AbstractMeasure
Expand Down

0 comments on commit 56157f9

Please sign in to comment.