pub trait Diffusion<S: State, B: NoiseIncrement>: Send + Sync {
// Required method
fn apply(&self, x: &S, t: f64, dw: &B) -> S;
}Expand description
Diffusion coefficient interface.
apply(x, t, dw) returns the diffusion contribution g(x,t) * dw directly.
Blanket impl for scalar closures: f(x,t) -> f64 satisfies Diffusion<f64, f64>
by computing f(x,t) * dw.
Blanket impl for nD diagonal closures: f(x,t) -> SVector<N> satisfies
Diffusion<SVector<N>, SVector<N>> by element-wise (Hadamard) product.
Full-matrix processes (Heston, CorrOU) provide concrete struct impls.
§Calling convention
Scalar diffusions (B = f64) receive x by value because f64: Copy.
Vector diffusions (B = SVector<f64, N>) receive x by reference.
Concrete struct impls (e.g. HestonDiffusion) use whichever is appropriate for their state type.