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§
Provided Methods§
Sourcefn parameters(&self) -> Vec<f64>
fn parameters(&self) -> Vec<f64>
Return the model’s parameters as a Vec<f64>.
Sourcefn euler_maruyama(&self, config: &StochasticProcessConfig) -> Trajectories
fn euler_maruyama(&self, config: &StochasticProcessConfig) -> Trajectories
Euler-Maruyama discretisation scheme.
§Arguments:
x_0- The process’ initial value att_0.t_0- The initial time point.t_n- The terminal time point.n_steps- The number of time steps betweent_0andt_n.m_paths- How many process trajectories to simulate.parallel- Run in parallel or not (recommended for > 1000 paths).
Sourcefn seedable_euler_maruyama(
&self,
x_0: f64,
t_0: f64,
t_n: f64,
n_steps: usize,
m_paths: usize,
parallel: bool,
seed: u64,
) -> 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
Euler-Maruyama discretisation scheme with a choice of random seed.
§Arguments:
x_0- The process’ initial value att_0.t_0- The initial time point.t_n- The terminal time point.n_steps- The number of time steps betweent_0andt_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.