add_vec_vec

Function add_vec_vec 

Source
pub fn add_vec_vec(x: &[f64], y: &[f64]) -> Vec<f64>
Expand description

§add_vec_vec(x, y)

Operation Function

The add_vec_vec function adds corresponding elements of vectors x and y using the add function, then returns a new vector containing their sums.

§Examples

use mathlab::math::{add, add_vec_vec, fround_vec};
assert_eq!(add(0.1, 0.2), 0.30000000000000004);
assert_eq!(add(0.1, 0.2) as f32, 0.3);
assert_eq!(add_vec_vec(&[0.0, 0.1, 0.2, 0.3], &[0.3, 0.2, 0.1, 0.0]), [0.3, 0.30000000000000004, 0.30000000000000004, 0.3]);
assert_eq!(fround_vec(&add_vec_vec(&[0.0, 0.1, 0.2, 0.3], &[0.3, 0.2, 0.1, 0.0])), [0.3, 0.3, 0.3, 0.3]);

End Fun Doc