Skip to main content

Scheme

Trait Scheme 

Source
pub trait Scheme<S: State>: Send + Sync {
    type Noise: NoiseIncrement;

    // Required method
    fn step<D, G>(
        &self,
        drift: &D,
        diffusion: &G,
        x: &S,
        t: f64,
        dt: f64,
        inc: &Increment<Self::Noise>,
    ) -> S
       where D: Drift<S>,
             G: Diffusion<S, Self::Noise>;
}
Expand description

One-step advance of an SDE of type S.

The type Noise associated type fixes the noise increment type for this scheme. For all current schemes on scalar or nD-diagonal processes, Noise = S.

Required Associated Types§

Required Methods§

Source

fn step<D, G>( &self, drift: &D, diffusion: &G, x: &S, t: f64, dt: f64, inc: &Increment<Self::Noise>, ) -> S
where D: Drift<S>, G: Diffusion<S, Self::Noise>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Scheme<f64> for Milstein

Scalar Milstein scheme (strong order 1.0 for state-dependent diffusion). Uses central finite difference to approximate dg/dx. x_{n+1} = x_n + fdt + gdw + 0.5g(dg/dx)*(dw^2 - dt)

Source§

impl Scheme<f64> for Sri

Source§

impl<S: State + NoiseIncrement> Scheme<S> for EulerMaruyama

Generic Euler-Maruyama: works for any State S with Noise = S. x_{n+1} = x_n + f(x_n, t)*dt + g(x_n, t)*dW

Source§

type Noise = S

Source§

impl<const N: usize> Scheme<Matrix<f64, Const<N>, Const<1>, ArrayStorage<f64, N, 1>>> for MilsteinNd<N>