Closed FredericWantiez closed 1 year ago
function transition!!(rng::AbstractRNG, t::Int, particle::Particle{<:LinearSSM})
if t == 1
return Particle(LinearSSM(rand(rng, f0(t))))
else
return Particle(LinearSSM(rand(rng, f(t, particle.model.state))))
end
end
function transition!!(rng::AbstractRNG, t::Int, m::LinearSSM, particle::Particle)
if t == 1
return Particle(rand(rng, f0(t)), m)
else
return Particle(rand(rng, f(t, particle.model.state)), m)
end
end
struct Particle{T}
z::T
end
Particle(z, m) = particleof(m)(z)
function particleof(::AbstractSSMProblem)
particleof(::LinearSSM) = Vector{Float32}
@devmotion can you take a look at this PR? I'm very involved in the discussions so might be slightly biased.
573cab3 actually feels a bit weird, the model definition is now specialized to the concrete particle type:
where if we just dispatch on the model, like in 6394704, we can drop-in different particle estimators with different specialization of
AbastractParticle{T}