Skip to main content

scale_expansion

Function scale_expansion 

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

Scale an expansion by a scalar: h = e * b.

e is the input expansion (length elen), b is the scalar, h is the output buffer (must have length >= 2 * elen). Returns the number of components written to h (at most 2 * elen).

Implements Shewchuk’s scale_expansion (§2.5): each component e[i] is split into (e[i] * b, error) via two_product, and the errors are accumulated into the output using two_sum, maintaining the non-overlapping + sorted invariant.

§Errors

Returns ExpansionError::OutputTooSmall if h.len() < 2 * elen.