From 83d5b6565752fc7fa035615336e3314ded0140cd Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Tue, 29 Oct 2024 23:37:42 +0000 Subject: [PATCH] Implement getindex for UntypedVarInfo --- src/varinfo.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/varinfo.jl b/src/varinfo.jl index 11fe08d0f..1dbd4cc9f 100644 --- a/src/varinfo.jl +++ b/src/varinfo.jl @@ -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]) +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