[−][src]Macro ndarray_parallel::par_azip
Parallel version of the azip!
macro.
See the azip!
documentation for more details.
This example:
ⓘThis example is not tested
par_azip!(mut a, b, c in { *a = b + c })
Is equivalent to:
ⓘThis example is not tested
Zip::from(&mut a).and(&b).and(&c).par_apply(|a, &b, &c| { *a = b + c; });
Panics if any of the arrays are not of the same shape.
Examples
extern crate ndarray; #[macro_use(par_azip)] extern crate ndarray_parallel; use ndarray::Array2; type M = Array2<f32>; fn main() { let mut a = M::zeros((16, 16)); let b = M::from_elem(a.dim(), 1.); let c = M::from_elem(a.dim(), 2.); // Compute a simple ternary operation: // elementwise addition of b and c, stored in a par_azip!(mut a, b, c in { *a = b + c }); assert_eq!(a, &b + &c); }