From e5e83a1483bb57f9158ae8d20c8714992813fe83 Mon Sep 17 00:00:00 2001 From: McCoy Becker Date: Mon, 18 Apr 2022 14:27:59 -0400 Subject: [PATCH 1/2] Implement _fill_array! for VectorTraceChoiceMap. --- src/modeling_library/vector.jl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/modeling_library/vector.jl b/src/modeling_library/vector.jl index f35360b50..c3b1ea1c2 100644 --- a/src/modeling_library/vector.jl +++ b/src/modeling_library/vector.jl @@ -96,6 +96,17 @@ end @inline has_value(choices::VectorTraceChoiceMap, addr::Pair) = _has_value(choices, addr) @inline get_values_shallow(::VectorTraceChoiceMap) = () +function _fill_array!(chm::VectorTraceChoiceMap, v::Vector{T}, start_idx::Int64) where T + idx = start_idx + tr = chm.trace + for k in 1 : tr.len + sub_tr = chm.subtraces[k] + sub_chm = get_choices(sub_tr) + n = _fill_array!(sub_chm, v, idx) + idx += n + end + return idx - start_idx +end ############################################ # code shared by vector-shaped combinators # From ae0c19a9c651121576ad3bf149ecbed8ceae56df Mon Sep 17 00:00:00 2001 From: McCoy Becker Date: Mon, 18 Apr 2022 15:21:04 -0400 Subject: [PATCH 2/2] Implement _fill_array! for VectorTraceChoiceMap. --- src/modeling_library/vector.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modeling_library/vector.jl b/src/modeling_library/vector.jl index c3b1ea1c2..2f22e9e34 100644 --- a/src/modeling_library/vector.jl +++ b/src/modeling_library/vector.jl @@ -100,7 +100,7 @@ function _fill_array!(chm::VectorTraceChoiceMap, v::Vector{T}, start_idx::Int64) idx = start_idx tr = chm.trace for k in 1 : tr.len - sub_tr = chm.subtraces[k] + sub_tr = tr.subtraces[k] sub_chm = get_choices(sub_tr) n = _fill_array!(sub_chm, v, idx) idx += n