pub trait StochasticProcess: Sync {
// Required methods
fn dim(&self) -> usize;
fn factors(&self) -> usize;
fn drift(&self, t: f64, x: &[f64], out: &mut [f64]);
fn diffusion(&self, t: f64, x: &[f64], out: &mut [f64]);
// Provided methods
fn constrain(&self, _x: &mut [f64]) { ... }
fn evolve(&self, t: f64, x: &[f64], dt: f64, dw: &[f64], out: &mut [f64]) { ... }
}Expand description
An N-state Itô process driven by M independent Brownian factors:
dX_i = a_i(t, X) dt + Σ_j b_ij(t, X) dW_j. Factor correlation is
expressed through the rows of the diffusion matrix (its Cholesky
structure), so dw always carries independent increments.
Required Methods§
Provided Methods§
Sourcefn constrain(&self, _x: &mut [f64])
fn constrain(&self, _x: &mut [f64])
State constraint applied after every step (identity by default).
Sourcefn evolve(&self, t: f64, x: &[f64], dt: f64, dw: &[f64], out: &mut [f64])
fn evolve(&self, t: f64, x: &[f64], dt: f64, dw: &[f64], out: &mut [f64])
One Euler-Maruyama step from x into out. The default
allocates small scratch buffers; hot loops should override with
model-specific stepping (which is also where non-Euler schemes —
exact transitions, Heston full-truncation/QE — live, since
generic multi-factor Milstein would need Lévy areas).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".