Skip to main content

SdeSystem

Trait SdeSystem 

Source
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§

Source

fn dim(&self) -> usize

Dimension of the state space.

Source

fn drift(&self, t: S, x: &[S], f: &mut [S])

Evaluate the drift function f(t, x).

§Arguments
  • t - Current time
  • x - Current state
  • f - Output buffer for drift (length = dim)
Source

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 time
  • x - Current state
  • g - Output buffer for diffusion

Provided Methods§

Source

fn noise_type(&self) -> NoiseType

Type of noise (default: diagonal).

Source

fn n_wiener(&self) -> usize

Number of Wiener processes.

Source

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.

Implementors§