StochasticProcess

Trait StochasticProcess 

Source
pub trait StochasticProcess: Sync {
    // Required methods
    fn drift(&self, x: f64, t: f64) -> f64;
    fn diffusion(&self, x: f64, t: f64) -> f64;
    fn jump(&self, x: f64, t: f64) -> Option<f64>;

    // Provided methods
    fn parameters(&self) -> Vec<f64> { ... }
    fn euler_maruyama(&self, config: &StochasticProcessConfig) -> Trajectories { ... }
    fn seedable_euler_maruyama(
        &self,
        x_0: f64,
        t_0: f64,
        t_n: f64,
        n_steps: usize,
        m_paths: usize,
        parallel: bool,
        seed: u64,
    ) -> Trajectories { ... }
}
Expand description

Trait to implement stochastic processes.

Required Methods§

Source

fn drift(&self, x: f64, t: f64) -> f64

Base method for the process’ drift.

Source

fn diffusion(&self, x: f64, t: f64) -> f64

Base method for the process’ diffusion.

Source

fn jump(&self, x: f64, t: f64) -> Option<f64>

Base method for the process’ jump term (if applicable).

Provided Methods§

Source

fn parameters(&self) -> Vec<f64>

Return the model’s parameters as a Vec<f64>.

Source

fn euler_maruyama(&self, config: &StochasticProcessConfig) -> Trajectories

Euler-Maruyama discretisation scheme.

§Arguments:
  • x_0 - The process’ initial value at t_0.
  • t_0 - The initial time point.
  • t_n - The terminal time point.
  • n_steps - The number of time steps between t_0 and t_n.
  • m_paths - How many process trajectories to simulate.
  • parallel - Run in parallel or not (recommended for > 1000 paths).
Source

fn seedable_euler_maruyama( &self, x_0: f64, t_0: f64, t_n: f64, n_steps: usize, m_paths: usize, parallel: bool, seed: u64, ) -> Trajectories

Euler-Maruyama discretisation scheme with a choice of random seed.

§Arguments:
  • x_0 - The process’ initial value at t_0.
  • t_0 - The initial time point.
  • t_n - The terminal time point.
  • n_steps - The number of time steps between t_0 and t_n.
  • m_paths - How many process trajectories to simulate.
  • parallel - Run in parallel or not (recommended for > 1000 paths).
  • seed - The seed for the random number generator.

Implementors§