Skip to content

Commit ebeee8e

Browse files
committed
add Base.copy(::ParticleFilterState)
1 parent 262f96f commit ebeee8e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/inference/particle_filter.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ mutable struct ParticleFilterState{U}
2323
parents::Vector{Int}
2424
end
2525

26+
function Base.copy(state::ParticleFilterState{U}) where U
27+
ParticleFilterState{U}(
28+
copy(state.traces),
29+
copy(state.new_traces),
30+
copy(state.log_weights),
31+
state.log_ml_est,
32+
copy(state.parents)
33+
)
34+
end
35+
2636
"""
2737
traces = get_traces(state::ParticleFilterState)
2838

0 commit comments

Comments
 (0)