Skip to content

Commit

Permalink
Implement getindex for UntypedVarInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
penelopeysm committed Oct 29, 2024
1 parent 18af48a commit 83d5b65
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/varinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1694,6 +1694,10 @@ Return the current value(s) of the random variables sampled by `spl` in `vi`.
The value(s) may or may not be transformed to Euclidean space.
"""
function getindex(vi::UntypedVarInfo, spl::Sampler)
indices = _getranges(vi, spl)
return copy(vi.metadata.vals[indices])

Check warning on line 1699 in src/varinfo.jl

View check run for this annotation

Codecov / codecov/patch

src/varinfo.jl#L1697-L1699

Added lines #L1697 - L1699 were not covered by tests
end
getindex(vi::VarInfo, spl::Sampler) = copy(getindex_internal(vi, _getranges(vi, spl)))
function getindex(vi::TypedVarInfo, spl::Sampler)
# Gets the ranges as a NamedTuple
Expand Down

0 comments on commit 83d5b65

Please sign in to comment.