diff --git a/src/container.jl b/src/container.jl index 695892ea..d092340a 100644 --- a/src/container.jl +++ b/src/container.jl @@ -1,7 +1,7 @@ -struct Trace{F,U,N,V<:Random123.AbstractR123{U}} +struct Trace{F,R<:TracedRNG} f::F ctask::Libtask.CTask - rng::TracedRNG{U,N,V} + rng::R end const Particle = Trace @@ -95,13 +95,13 @@ Data structure for particle filters - normalise!(pc::ParticleContainer) - consume(pc::ParticleContainer): return incremental likelihood """ -mutable struct ParticleContainer{T<:Particle,U,N,V<:Random123.AbstractR123{U}} +mutable struct ParticleContainer{T<:Particle,R<:TracedRNG} "Particles." vals::Vector{T} "Unnormalized logarithmic weights." logWs::Vector{Float64} "Traced RNG to replay the resampling step" - rng::TracedRNG{U,N,V} + rng::R end function ParticleContainer(particles::Vector{<:Particle}) @@ -207,6 +207,7 @@ function update_keys!(pc::ParticleContainer, ref::Union{Particle,Nothing}=nothin k = split(pi.rng.rng.key) Random.seed!(pi.rng, k[1]) end + return nothing end """ diff --git a/test/container.jl b/test/container.jl index 1dbc33df..88a6dc03 100644 --- a/test/container.jl +++ b/test/container.jl @@ -11,7 +11,7 @@ # Create a resumable function that always returns the same log probability. function fpc(logp) f = let logp = logp - (rng) -> begin + rng -> begin while true produce(logp) end