Skip to main content

floating_zone_walk

Function floating_zone_walk 

Source
pub fn floating_zone_walk<E, Err>(
    local_dims: &[usize],
    init_p: &MultiIndex,
    max_sweeps: usize,
    early_stop_tol: f64,
    eval_batch: E,
) -> Result<(MultiIndex, f64), Err>
where E: FnMut(&[MultiIndex]) -> Result<Vec<f64>, Err>,
Expand description

Walk one floating-zone search trajectory.

Mirrors TensorCrossInterpolation.jl’s _floatingzone: starting from init_p, each sweep visits every site in order and moves that site’s coordinate to the value with the largest error (as measured by eval_batch), keeping the running maximum error monotonically non-decreasing. The walk stops when a sweep does not increase the maximum error (the trajectory is stuck on a local maximum) or when the maximum error exceeds early_stop_tol (the point is already significant), or after max_sweeps sweeps as a safety bound.

§Arguments

  • local_dims - Local dimension of each site.
  • init_p - Starting multi-index; must have length local_dims.len().
  • max_sweeps - Upper bound on the number of coordinate sweeps. The no-improvement early stop almost always fires first.
  • early_stop_tol - Stop walking once the maximum error exceeds this value; the caller has found a significantly wrong point.
  • eval_batch - Evaluates the error magnitude |f - tt| at a batch of multi-indices. Called once per site per sweep with that site’s local_dims[site] candidate points (the current pivot with the site coordinate varied), so callers can batch shared contractions.

§Returns

The final pivot and the maximum error encountered along the walk. The returned error may exceed early_stop_tol; the caller decides whether the point is significant.

§Errors

Propagates the error returned by eval_batch unchanged — typically an operation failure or an index mismatch from the underlying evaluator.