Skip to content

Commit 851630f

Browse files
committed
Move has_varnamedvector(varinfo::VarInfo) to abstract_varinfo.jl
1 parent 5bbba91 commit 851630f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/abstract_varinfo.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,13 @@ function Base.eltype(vi::AbstractVarInfo, spl::Union{AbstractSampler,SampleFromP
363363
return eltype(T)
364364
end
365365

366+
"""
367+
has_varnamedvector(varinfo::VarInfo)
368+
369+
Returns `true` if `varinfo` uses `VarNamedVector` as metadata.
370+
"""
371+
has_varnamedvector(vi::AbstractVarInfo) = false
372+
366373
# TODO: Should relax constraints on `vns` to be `AbstractVector{<:Any}` and just try to convert
367374
# the `eltype` to `VarName`? This might be useful when someone does `[@varname(x[1]), @varname(m)]` which
368375
# might result in a `Vector{Any}`.
@@ -554,7 +561,7 @@ end
554561
link([t::AbstractTransformation, ]vi::AbstractVarInfo, model::Model)
555562
link([t::AbstractTransformation, ]vi::AbstractVarInfo, spl::AbstractSampler, model::Model)
556563
557-
Transform the variables in `vi` to their linked space without mutating `vi`, using the transformation `t`.
564+
Transform the variables in `vi` to their linked space without mutating `vi`, using the transformation `t`.
558565
559566
If `t` is not provided, `default_transformation(model, vi)` will be used.
560567
@@ -573,7 +580,7 @@ end
573580
invlink!!([t::AbstractTransformation, ]vi::AbstractVarInfo, model::Model)
574581
invlink!!([t::AbstractTransformation, ]vi::AbstractVarInfo, spl::AbstractSampler, model::Model)
575582
576-
Transform the variables in `vi` to their constrained space, using the (inverse of)
583+
Transform the variables in `vi` to their constrained space, using the (inverse of)
577584
transformation `t`, mutating `vi` if possible.
578585
579586
If `t` is not provided, `default_transformation(model, vi)` will be used.

src/varinfo.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,6 @@ function VectorVarInfo(vi::TypedVarInfo)
158158
return VarInfo(md, Base.RefValue{eltype(lp)}(lp), Ref(get_num_produce(vi)))
159159
end
160160

161-
"""
162-
has_varnamedvector(varinfo::VarInfo)
163-
164-
Returns `true` if `varinfo` uses `VarNamedVector` as metadata.
165-
"""
166-
has_varnamedvector(vi::AbstractVarInfo) = false
167161
function has_varnamedvector(vi::VarInfo)
168162
return vi.metadata isa VarNamedVector ||
169163
(vi isa TypedVarInfo && any(Base.Fix2(isa, VarNamedVector), values(vi.metadata)))

0 commit comments

Comments
 (0)