Function rulinalg::utils::vec_bin_op [] [src]

pub fn vec_bin_op<F, T>(u: &[T], v: &[T], f: F) -> Vec<T> where F: Fn(T, T) -> T, T: Copy

Vectorized binary operation applied to two slices.

Examples

use rulinalg::utils;

let mut a = vec![2.0; 10];
let b = vec![3.0; 10];

let c = utils::vec_bin_op(&a, &b, |x, y| { 1f64 + x * y });

// Will print a vector of `7`s.
println!("{:?}", a);