Skip to main content

simulate_nd

Function simulate_nd 

Source
pub fn simulate_nd<const N: usize, D, G, SC>(
    drift: &D,
    diffusion: &G,
    scheme: &SC,
    x0: SVector<f64, N>,
    t0: f64,
    t1: f64,
    n_paths: usize,
    n_steps: usize,
    seed: u64,
) -> Result<Array3<f64>, PathwiseError>
where D: Fn(&SVector<f64, N>, f64) -> SVector<f64, N> + Send + Sync, G: Diffusion<SVector<f64, N>, SVector<f64, N>> + Sync, SC: Scheme<SVector<f64, N>, Noise = SVector<f64, N>>,
Expand description

Simulate n_paths paths of an N-dimensional SDE from t0 to t1.

Returns Array3 of shape (n_paths, n_steps + 1, N). Negative values in each component are NOT clipped unless the process does so in its diffusion (e.g. CIR, Heston full-truncation).