Modified the definitions of the interface to align the obs/dyn time steps as per #54
Introduced type parameters to the dyn/obs representing the state/observation types
Used these type parameters and new alignment to refactor the forward simulation code
Added a unit test for forward simulation
I have a fear that these new type parameters, although useful, might be a bit over-engineered and lead to sticky edge-cases. Very happy to revert those changes if others think that is best.
TODO:
[ ] If we're happy with these type parameters, it may be worth updating the method signatures to include them, e.g. distribution(dyn::LatentDynamics, step::Integer, prev_state, extra) -> distribution(dyn::LatentDynamics{T}, step::Integer, prev_state:T, extra). This could potentially lead to method ambiguity errors if the user misses out these types in their own definition (their dynamics will be more specific, but the documentation's state will be more specific).
[ ] I'm currently not returning the initial state x0 or allowing an extra to be passed to initialisation. This is because doing so would required xs/extras to have a zero index. This could be handled by offset arrays but that feels like a big dependency. Kalman.jl handles this by using a vector of pairs t => x but that feels clunky. I question how much the initial state/extra for initial are actually needed.
Changes:
I have a fear that these new type parameters, although useful, might be a bit over-engineered and lead to sticky edge-cases. Very happy to revert those changes if others think that is best.
TODO:
distribution(dyn::LatentDynamics, step::Integer, prev_state, extra)
->distribution(dyn::LatentDynamics{T}, step::Integer, prev_state:T, extra)
. This could potentially lead to method ambiguity errors if the user misses out these types in their own definition (their dynamics will be more specific, but the documentation's state will be more specific).x0
or allowing anextra
to be passed to initialisation. This is because doing so would requiredxs
/extras
to have a zero index. This could be handled by offset arrays but that feels like a big dependency.Kalman.jl
handles this by using a vector of pairst => x
but that feels clunky. I question how much the initial state/extra
for initial are actually needed.