pub struct WassersteinGradientFlow {
pub tau: f64,
pub positions: Vec<f64>,
pub n_particles: usize,
pub potential_alpha: f64,
}Expand description
Wasserstein gradient flow simulation using the JKO (Jordan-Kinderlehrer-Otto) minimising movement scheme.
Evolves a discrete probability measure ρ = (x_i, w_i) under the gradient flow of the free energy F[ρ] = ∫ ρ log ρ dx + ∫ V ρ dx (Fokker-Planck).
Fields§
§tau: f64JKO time step τ.
positions: Vec<f64>Current particle positions x_i.
n_particles: usizeEqual weights w_i = 1/N.
potential_alpha: f64Potential V(x) = α x² / 2 (quadratic confining potential), coefficient α.
Implementations§
Source§impl WassersteinGradientFlow
impl WassersteinGradientFlow
Sourcepub fn new(n_particles: usize, tau: f64, potential_alpha: f64) -> Self
pub fn new(n_particles: usize, tau: f64, potential_alpha: f64) -> Self
Initialise with N Gaussian-distributed particles.
Sourcepub fn step(&mut self)
pub fn step(&mut self)
Perform one JKO step: move particles to minimise τ F[ρ] + W_2²(ρ^n, ρ) / 2 via a proximal operator. For the quadratic potential V = α x²/2 the JKO update has the closed-form shrinkage: x_i^{n+1} = x_i^n / (1 + τ α).
Sourcepub fn steady_state_variance(&self) -> f64
pub fn steady_state_variance(&self) -> f64
Steady-state variance: σ² = 1/(τ α N) · N = 1/α (Gaussian with covariance 1/α).
Trait Implementations§
Source§impl Clone for WassersteinGradientFlow
impl Clone for WassersteinGradientFlow
Source§fn clone(&self) -> WassersteinGradientFlow
fn clone(&self) -> WassersteinGradientFlow
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WassersteinGradientFlow
impl RefUnwindSafe for WassersteinGradientFlow
impl Send for WassersteinGradientFlow
impl Sync for WassersteinGradientFlow
impl Unpin for WassersteinGradientFlow
impl UnsafeUnpin for WassersteinGradientFlow
impl UnwindSafe for WassersteinGradientFlow
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more