Function winter_math::add_in_place[][src]

pub fn add_in_place<E>(a: &mut [E], b: &[E]) where
    E: FieldElement
Expand description

Computes element-wise sum of the provided vectors, and stores the result in the first vector.

When concurrent feature is enabled, the summation is performed concurrently in multiple threads.

Panics

Panics if lengths of a and b vectors are not the same.

Examples

let a: Vec<BaseElement> = rand_vector(2048);
let b: Vec<BaseElement> = rand_vector(2048);

let mut c = a.clone();
add_in_place(&mut c, &b);

for ((a, b), c) in a.into_iter().zip(b).zip(c) {
    assert_eq!(a + b, c);
}