Skip to content

Commit e38ba9e

Browse files
committed
moved impls of acclogp!! and setlogp!! for SimpleVarInfo next to each other
1 parent 8a527a6 commit e38ba9e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/simple_varinfo.jl

+8-8
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,6 @@ getlogp(vi::SimpleVarInfo{<:Any,<:Ref}) = vi.logp[]
264264
setlogp!!(vi::SimpleVarInfo, logp) = Setfield.@set vi.logp = logp
265265
acclogp!!(vi::SimpleVarInfo, logp) = Setfield.@set vi.logp = getlogp(vi) + logp
266266

267-
"""
268-
keys(vi::SimpleVarInfo)
269-
270-
Return an iterator of keys present in `vi`.
271-
"""
272-
Base.keys(vi::SimpleVarInfo) = keys(vi.values)
273-
Base.keys(vi::SimpleVarInfo{<:NamedTuple}) = map(k -> VarName{k}(), keys(vi.values))
274-
275267
function setlogp!!(vi::SimpleVarInfo{<:Any,<:Ref}, logp)
276268
vi.logp[] = logp
277269
return vi
@@ -282,6 +274,14 @@ function acclogp!!(vi::SimpleVarInfo{<:Any,<:Ref}, logp)
282274
return vi
283275
end
284276

277+
"""
278+
keys(vi::SimpleVarInfo)
279+
280+
Return an iterator of keys present in `vi`.
281+
"""
282+
Base.keys(vi::SimpleVarInfo) = keys(vi.values)
283+
Base.keys(vi::SimpleVarInfo{<:NamedTuple}) = map(k -> VarName{k}(), keys(vi.values))
284+
285285
function Base.show(io::IO, ::MIME"text/plain", svi::SimpleVarInfo)
286286
if !(svi.transformation isa NoTransformation)
287287
print(io, "Transformed ")

0 commit comments

Comments
 (0)