Skip to main content

sum

Function sum 

Source
pub fn sum(e: &[f64], f: &[f64], out: &mut [f64]) -> usize
Expand description

Writes the expansion of e + f.

Capacity: e.len() + f.len(). Requirement: e and f are valid expansions (see the module documentation). Guarantee: the result is a valid expansion.

This is the linear-time LINEAR-EXPANSION-SUM rather than the faster FAST-EXPANSION-SUM because its nonoverlapping guarantee holds for any nonoverlapping inputs.

ยงExamples

use implicit_predicates_core::expansion;

let mut out = [0.0; 4];
let len = expansion::sum(&[1e-20, 1.0], &[-1e-20, 2.0], &mut out);
assert_eq!(&out[..len], &[3.0]);