Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement _fill_array! for VectorTraceChoiceMap. #465

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/modeling_library/vector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = tr.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 #
Expand Down