Skip to main content

Step

Trait Step 

Source
pub trait Step<T>: Sync {
    type Cell: AtomicCell<T>;

    // Required method
    fn run<G, N>(&self, idx: usize, get: G, neighbors: N) -> (f64, Option<T>)
       where G: Fn(usize) -> T,
             N: Iterator<Item = usize>;
}
Expand description

A per-root Newton correction step shared by every execution policy.

run(idx, get, neighbors) computes one correction for root/factor idx:

  • get(j) reads the current value of root/factor j from the policy’s data layout (live state, frozen snapshot, or seqlock buffer).
  • neighbors enumerates the indices of the other roots/factors to suppress (ascending order, or round-robin for the atomic variant).

Returns (tol, Some(new_value)) when the root was updated, or (0.0, None) when it is already converged (below options.tol_ind).

This mirrors the per-algorithm step functors (even_bairstow_step, autocorr_bairstow_step, aberth_step, …) in ginger-cpp’s execution_policy.hpp.

Required Associated Types§

Source

type Cell: AtomicCell<T>

Atomic cell type used by the decoupled atomic policy for this step.

Required Methods§

Source

fn run<G, N>(&self, idx: usize, get: G, neighbors: N) -> (f64, Option<T>)
where G: Fn(usize) -> T, N: Iterator<Item = usize>,

Compute one Newton correction for root/factor idx.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§