Skip to main content

compress_expansion

Function compress_expansion 

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

Compress an expansion: eliminate near-zero and zero components, producing a minimal-length expansion with the same exact value.

e is the input expansion, h is the output buffer (must have length >= e.len()). Returns the number of components written to h.

Implements Shewchuk’s compress (§2.7): a two-pass accumulation that merges adjacent components, eliminating zeros and reducing the expansion to its minimal non-overlapping form.

§Errors

Returns ExpansionError::OutputTooSmall if h.len() < e.len().