Skip to content

Commit d30daa1

Browse files
committed
Remove AbstractFastEvalContext
1 parent e030d42 commit d30daa1

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/fasteval.jl

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,22 +145,12 @@ struct RangeAndLinked
145145
is_linked::Bool
146146
end
147147

148-
"""
149-
AbstractFastEvalContext
150-
151-
Abstract type representing fast evaluation contexts. This currently is only subtyped by
152-
`FastEvalVectorContext`. However, in the future, similar contexts may be implemented for
153-
NamedTuple and Dict parameters.
154-
"""
155-
abstract type AbstractFastEvalContext <: AbstractContext end
156-
DynamicPPL.NodeTrait(::AbstractFastEvalContext) = DynamicPPL.IsLeaf()
157-
158148
"""
159149
FastEvalVectorContext(
160150
iden_varname_ranges::NamedTuple,
161151
varname_ranges::Dict{VarName,RangeAndLinked},
162152
params::AbstractVector{<:Real},
163-
)
153+
) <: AbstractContext
164154
165155
A context that wraps a vector of parameter values, plus information about how random
166156
variables map to ranges in that vector.
@@ -173,15 +163,16 @@ non-identity-optic VarNames are stored in the `varname_ranges` Dict.
173163
It would be nice to unify the NamedTuple and Dict approach. See, e.g.
174164
https://github.com/TuringLang/DynamicPPL.jl/issues/1116.
175165
"""
176-
struct FastEvalVectorContext{N<:NamedTuple,T<:AbstractVector{<:Real}} <:
177-
AbstractFastEvalContext
166+
struct FastEvalVectorContext{N<:NamedTuple,T<:AbstractVector{<:Real}} <: AbstractContext
178167
# This NamedTuple stores the ranges for identity VarNames
179168
iden_varname_ranges::N
180169
# This Dict stores the ranges for all other VarNames
181170
varname_ranges::Dict{VarName,RangeAndLinked}
182171
# The full parameter vector which we index into to get variable values
183172
params::T
184173
end
174+
DynamicPPL.NodeTrait(::FastEvalVectorContext) = DynamicPPL.IsLeaf()
175+
185176
function get_range_and_linked(
186177
ctx::FastEvalVectorContext, ::VarName{sym,typeof(identity)}
187178
) where {sym}

0 commit comments

Comments
 (0)