pub trait SdeSystem<S: Scalar>: Sync {
// Required methods
fn dim(&self) -> usize;
fn drift(&self, t: S, x: &[S], f: &mut [S]);
fn diffusion(&self, t: S, x: &[S], g: &mut [S]);
// Provided methods
fn noise_type(&self) -> NoiseType { ... }
fn n_wiener(&self) -> usize { ... }
fn diffusion_derivative(&self, t: S, x: &[S], gdg: &mut [S]) { ... }
}Expand description
Trait for stochastic differential equation systems.
Defines an SDE of the form:
dX(t) = f(t, X) dt + g(t, X) dW(t)Required Methods§
Sourcefn drift(&self, t: S, x: &[S], f: &mut [S])
fn drift(&self, t: S, x: &[S], f: &mut [S])
Evaluate the drift function f(t, x).
§Arguments
t- Current timex- Current statef- Output buffer for drift (length = dim)
Sourcefn diffusion(&self, t: S, x: &[S], g: &mut [S])
fn diffusion(&self, t: S, x: &[S], g: &mut [S])
Evaluate the diffusion function g(t, x).
For diagonal noise, g has length dim.
For scalar noise, g has length dim (same noise scaled differently).
For general noise, g has length dim * n_wiener.
§Arguments
t- Current timex- Current stateg- Output buffer for diffusion
Provided Methods§
Sourcefn noise_type(&self) -> NoiseType
fn noise_type(&self) -> NoiseType
Type of noise (default: diagonal).
Sourcefn diffusion_derivative(&self, t: S, x: &[S], gdg: &mut [S])
fn diffusion_derivative(&self, t: S, x: &[S], gdg: &mut [S])
Derivative of diffusion w.r.t. state: ∂g/∂x * g
Required for Milstein method. Default implementation uses finite differences.