|
1 | 1 | #![cfg(feature = "rayon")] |
2 | 2 |
|
3 | 3 | #[cfg(feature = "approx")] |
4 | | -use itertools::enumerate; |
| 4 | +use itertools::{assert_equal, cloned, enumerate}; |
5 | 5 | use ndarray::parallel::prelude::*; |
6 | 6 | use ndarray::prelude::*; |
7 | 7 | use std::sync::atomic::{AtomicUsize, Ordering}; |
@@ -71,3 +71,22 @@ fn test_indices_1() |
71 | 71 | }); |
72 | 72 | assert_eq!(count.load(Ordering::SeqCst), a1.len()); |
73 | 73 | } |
| 74 | + |
| 75 | +#[test] |
| 76 | +fn test_par_azip9() |
| 77 | +{ |
| 78 | + let mut a = Array::<i32, _>::zeros(62); |
| 79 | + let b = Array::from_shape_fn(a.dim(), |j| j as i32); |
| 80 | + let c = Array::from_shape_fn(a.dim(), |j| (j * 2) as i32); |
| 81 | + let d = Array::from_shape_fn(a.dim(), |j| (j * 4) as i32); |
| 82 | + let e = Array::from_shape_fn(a.dim(), |j| (j * 8) as i32); |
| 83 | + let f = Array::from_shape_fn(a.dim(), |j| (j * 16) as i32); |
| 84 | + let g = Array::from_shape_fn(a.dim(), |j| (j * 32) as i32); |
| 85 | + let h = Array::from_shape_fn(a.dim(), |j| (j * 64) as i32); |
| 86 | + let i = Array::from_shape_fn(a.dim(), |j| (j * 128) as i32); |
| 87 | + par_azip!((a in &mut a, &b in &b, &c in &c, &d in &d, &e in &e, &f in &f, &g in &g, &h in &h, &i in &i){ |
| 88 | + *a = b + c + d + e + f + g + h + i; |
| 89 | + }); |
| 90 | + let x = Array::from_shape_fn(a.dim(), |j| (j * 255) as i32); |
| 91 | + assert_equal(cloned(&a), x); |
| 92 | +} |
0 commit comments