Skip to main content

Module lgssm

Module lgssm 

Source
Expand description

Rust implementation of the Kalman filter forward pass for a linear Gaussian state-space model.

Match for KalmanFilter.filter() in src/sc_neurocore/world_model/predictive_model.py so that the Python and Rust paths return identical (within float64 round-off) means, covariances, and log-likelihood.

References match the Python module: Kalman 1960; Bishop 2006 §13.3.1.

Algorithm per timestep t: x_pred = A x_filt + B u P_pred = A P_filt A^T + Q e_t = y_t - C x_pred - D u S = C P_pred C^T + R K = P_pred C^T S^{-1} x_filt = x_pred + K e_t P_filt = (I - K C) P_pred (I - K C)^T + K R K^T (Joseph form) log-lik += -0.5 * (p log 2pi + log |S| + e_t^T S^{-1} e_t)

Structs§

KalmanResult
Result of the Kalman filter forward pass.

Functions§

kalman_filter
Run the forward Kalman filter on a sequence of observations.