Skip to main content

grow_expansion

Function grow_expansion 

Source
pub fn grow_expansion(
    e: &[f64],
    b: f64,
    h: &mut [f64],
) -> Result<usize, ExpansionError>
Expand description

Grow an expansion by adding a scalar: h = e + b.

e is the input expansion (length elen), b is the scalar, h is the output buffer (must have length >= elen + 1). Returns the number of components written to h (always elen + 1).

Implements Shewchuk’s grow_expansion (§2.4): a single pass that merges b into the expansion using fast_two_sum, maintaining the non-overlapping + sorted invariant.

§Errors

Returns ExpansionError::OutputTooSmall if h.len() < elen + 1.