Skip to content

Commit

Permalink
Implement custom getindex for UntypedVarInfo (#704)
Browse files Browse the repository at this point in the history
* Implement getindex for UntypedVarInfo

* Format

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
penelopeysm and github-actions[bot] authored Oct 31, 2024
1 parent 18af48a commit 99def88
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/varinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1694,6 +1694,8 @@ 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.
"""
getindex(vi::UntypedVarInfo, spl::Sampler) =
copy(getindex(vi.metadata.vals, _getranges(vi, spl)))
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 99def88

Please sign in to comment.