pub struct KuramotoSolver {
pub n: usize,
pub omega: Vec<f64>,
pub coupling: Vec<f64>,
pub phases: Vec<f64>,
pub noise_amp: f64,
pub field_pressure: f64,
dtheta: Vec<f64>,
sin_diff: Vec<f64>,
noise: Vec<f64>,
cos_theta: Vec<f64>,
geo_coupling: Vec<f64>,
pgbo_coupling: Vec<f64>,
}Expand description
High-performance Kuramoto oscillator solver.
Baseline equation:
dθ_n/dt = ω_n + Σ_m K_nm sin(θ_m - θ_n) + noise
SSGF extension (step_ssgf) adds geometry/PGBO/field terms:
+ σ_g Σ_m W_nm sin(θ_m - θ_n) + pgbo_w Σ_m h_nm sin(θ_m - θ_n) + F cos(θ_n).
Fields§
§n: usizeNumber of oscillators.
omega: Vec<f64>Natural frequencies ω_n, shape (n,).
coupling: Vec<f64>Baseline coupling matrix K_nm, row-major shape (n*n).
phases: Vec<f64>Current phase vector θ_n, shape (n,).
noise_amp: f64Gaussian noise amplitude.
field_pressure: f64Field pressure strength F used by step_ssgf.
dtheta: Vec<f64>Scratch: per-oscillator phase derivative.
sin_diff: Vec<f64>Scratch: sin(θ_m - θ_n) matrix, row-major (n*n).
noise: Vec<f64>Scratch: per-step standard normal draws.
cos_theta: Vec<f64>Scratch: cos(θ_n) vector for field-pressure term.
geo_coupling: Vec<f64>Scratch: geometry coupling contribution per oscillator.
pgbo_coupling: Vec<f64>Scratch: PGBO coupling contribution per oscillator.
Implementations§
Source§impl KuramotoSolver
impl KuramotoSolver
Sourcepub fn new(
omega: Vec<f64>,
coupling_flat: Vec<f64>,
initial_phases: Vec<f64>,
noise_amp: f64,
) -> Self
pub fn new( omega: Vec<f64>, coupling_flat: Vec<f64>, initial_phases: Vec<f64>, noise_amp: f64, ) -> Self
Create a new solver with preallocated scratch buffers.
Sourcepub fn set_field_pressure(&mut self, f: f64)
pub fn set_field_pressure(&mut self, f: f64)
Set external field pressure F for SSGF mode.
Sourcepub fn step(&mut self, dt: f64, seed: u64) -> f64
pub fn step(&mut self, dt: f64, seed: u64) -> f64
Advance one baseline Euler step.
Returns Kuramoto order parameter R ∈ [0, 1].
Sourcepub fn run(&mut self, n_steps: usize, dt: f64, seed: u64) -> Vec<f64>
pub fn run(&mut self, n_steps: usize, dt: f64, seed: u64) -> Vec<f64>
Advance N baseline steps and return R after each step.
Sourcepub fn step_ssgf(
&mut self,
dt: f64,
seed: u64,
w_flat: &[f64],
sigma_g: f64,
h_flat: &[f64],
pgbo_weight: f64,
) -> f64
pub fn step_ssgf( &mut self, dt: f64, seed: u64, w_flat: &[f64], sigma_g: f64, h_flat: &[f64], pgbo_weight: f64, ) -> f64
SSGF-compatible step with geometry and PGBO coupling.
w_flat: row-major geometry matrix W (n*n). Empty slice disables geometry term.
sigma_g: geometry coupling gain.
h_flat: row-major PGBO tensor h (n*n). Empty slice disables PGBO term.
pgbo_weight: PGBO coupling gain.
Returns Kuramoto order parameter R ∈ [0, 1].
Sourcepub fn run_ssgf(
&mut self,
n_steps: usize,
dt: f64,
seed: u64,
w_flat: &[f64],
sigma_g: f64,
h_flat: &[f64],
pgbo_weight: f64,
) -> Vec<f64>
pub fn run_ssgf( &mut self, n_steps: usize, dt: f64, seed: u64, w_flat: &[f64], sigma_g: f64, h_flat: &[f64], pgbo_weight: f64, ) -> Vec<f64>
Run N SSGF-compatible steps and return R after each step.
Sourcepub fn order_parameter(&self) -> f64
pub fn order_parameter(&self) -> f64
Compute Kuramoto order parameter
R = sqrt(mean(cos θ)^2 + mean(sin θ)^2).
Sourcepub fn get_phases(&self) -> &[f64]
pub fn get_phases(&self) -> &[f64]
Borrow current phase vector.
Sourcepub fn set_phases(&mut self, phases: Vec<f64>)
pub fn set_phases(&mut self, phases: Vec<f64>)
Replace phase vector.
Sourcepub fn set_coupling(&mut self, coupling_flat: Vec<f64>)
pub fn set_coupling(&mut self, coupling_flat: Vec<f64>)
Replace baseline coupling matrix.
Auto Trait Implementations§
impl Freeze for KuramotoSolver
impl RefUnwindSafe for KuramotoSolver
impl Send for KuramotoSolver
impl Sync for KuramotoSolver
impl Unpin for KuramotoSolver
impl UnsafeUnpin for KuramotoSolver
impl UnwindSafe for KuramotoSolver
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more