fast_sde/
math_utils.rs

1// src/math_utils.rs
2use statrs::function::erf;
3use std::f64::consts::SQRT_2;
4
5pub fn norm_cdf(x: f64) -> f64 {
6    0.5 * (1.0 + erf::erf(x / SQRT_2))
7}
8
9pub struct Timer {
10    start_time: std::time::Instant,
11}
12
13impl Timer {
14    pub fn new() -> Timer {
15        Timer { start_time: std::time::Instant::now() }
16    }
17
18    pub fn start(&mut self) {
19        self.start_time = std::time::Instant::now();
20    }
21
22    pub fn elapsed_ms(&self) -> f64 {
23        self.start_time.elapsed().as_secs_f64() * 1000.0
24    }
25}
26