Skip to main content

ParticleFilter

Struct ParticleFilter 

Source
pub struct ParticleFilter<'a> {
    pub cfg: ParticleConfig,
    pub q_chol: Vec<f64>,
    pub r: Vec<f64>,
    pub f: Box<dyn Fn(&[f64]) -> Vec<f64> + 'a>,
    pub h: Box<dyn Fn(&[f64]) -> Vec<f64> + 'a>,
    pub x0: Vec<f64>,
    pub p0_chol: Vec<f64>,
}
Expand description

Particle filter (SIR) for nonlinear non-Gaussian state-space models.

State model: x_t = f(x_{t-1}) + noise, noise ~ N(0, Q) Obs model: z_t = h(x_t) + v_t, v_t ~ N(0, R)

Fields§

§cfg: ParticleConfig

Filter configuration.

§q_chol: Vec<f64>

Cholesky factor L_Q (dim_x × dim_x lower triangular) of Q = L_Q L_Q^T.

§r: Vec<f64>

Observation noise covariance R (dim_z × dim_z, row-major).

§f: Box<dyn Fn(&[f64]) -> Vec<f64> + 'a>

Deterministic part of state transition: x_t = f(x_{t-1}) + noise.

§h: Box<dyn Fn(&[f64]) -> Vec<f64> + 'a>

Observation model: z_t = h(x_t).

§x0: Vec<f64>

Initial state distribution mean (length dim_x).

§p0_chol: Vec<f64>

Cholesky of initial covariance P_0 (lower triangular, dim_x × dim_x).

Implementations§

Source§

impl<'a> ParticleFilter<'a>

Source

pub fn run(&self, z: &[f64], rng: &mut LcgRng) -> SeqResult<ParticleResult>

Run the particle filter on observations z (T × dim_z, row-major flat).

Returns weighted state estimates, effective sample sizes, and resampling count.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ParticleFilter<'a>

§

impl<'a> !Send for ParticleFilter<'a>

§

impl<'a> !Sync for ParticleFilter<'a>

§

impl<'a> !UnwindSafe for ParticleFilter<'a>

§

impl<'a> Freeze for ParticleFilter<'a>

§

impl<'a> Unpin for ParticleFilter<'a>

§

impl<'a> UnsafeUnpin for ParticleFilter<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.