Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/parallel/impl_par_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,8 @@ zip_impl! {
[true P1 P2 P3],
[true P1 P2 P3 P4],
[true P1 P2 P3 P4 P5],
[false P1 P2 P3 P4 P5 P6],
[true P1 P2 P3 P4 P5 P6],
[true P1 P2 P3 P4 P5 P6 P7],
[true P1 P2 P3 P4 P5 P6 P7 P8],
[false P1 P2 P3 P4 P5 P6 P7 P8 P9],
}
3 changes: 3 additions & 0 deletions src/parallel/par.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ zip_impl! {
[P1 P2 P3 P4],
[P1 P2 P3 P4 P5],
[P1 P2 P3 P4 P5 P6],
[P1 P2 P3 P4 P5 P6 P7],
[P1 P2 P3 P4 P5 P6 P7 P8],
[P1 P2 P3 P4 P5 P6 P7 P8 P9],
}

impl<D, Parts> Parallel<Zip<Parts, D>>
Expand Down
11 changes: 10 additions & 1 deletion src/zip/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ offset_impl! {
[A B C D][ a b c d],
[A B C D E][ a b c d e],
[A B C D E F][ a b c d e f],
[A B C D E F G][ a b c d e f g],
[A B C D E F G H][ a b c d e f g h],
[A B C D E F G H I][ a b c d e f g h i],
}

macro_rules! zipt_impl {
Expand Down Expand Up @@ -563,6 +566,9 @@ zipt_impl! {
[A B C D][ a b c d],
[A B C D E][ a b c d e],
[A B C D E F][ a b c d e f],
[A B C D E F G][ a b c d e f g],
[A B C D E F G H][ a b c d e f g h],
[A B C D E F G H I][ a b c d e f g h i],
}

macro_rules! map_impl {
Expand Down Expand Up @@ -914,7 +920,10 @@ map_impl! {
[true P1 P2 P3],
[true P1 P2 P3 P4],
[true P1 P2 P3 P4 P5],
[false P1 P2 P3 P4 P5 P6],
[true P1 P2 P3 P4 P5 P6],
[true P1 P2 P3 P4 P5 P6 P7],
[true P1 P2 P3 P4 P5 P6 P7 P8],
[false P1 P2 P3 P4 P5 P6 P7 P8 P9],
}

/// Value controlling the execution of `.fold_while` on `Zip`.
Expand Down
19 changes: 19 additions & 0 deletions tests/azip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,3 +483,22 @@ fn test_zip_all_empty_array()
assert!(Zip::from(&a).and(&b).all(|&_x, &_y| true));
assert!(Zip::from(&a).and(&b).all(|&_x, &_y| false));
}

#[test]
fn test_azip9()
{
let mut a = Array::<i32, _>::zeros(62);
let b = Array::from_shape_fn(a.dim(), |j| j as i32);
let c = Array::from_shape_fn(a.dim(), |j| (j * 2) as i32);
let d = Array::from_shape_fn(a.dim(), |j| (j * 4) as i32);
let e = Array::from_shape_fn(a.dim(), |j| (j * 8) as i32);
let f = Array::from_shape_fn(a.dim(), |j| (j * 16) as i32);
let g = Array::from_shape_fn(a.dim(), |j| (j * 32) as i32);
let h = Array::from_shape_fn(a.dim(), |j| (j * 64) as i32);
let i = Array::from_shape_fn(a.dim(), |j| (j * 128) as i32);
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){
*a = b + c + d + e + f + g + h + i;
});
let x = Array::from_shape_fn(a.dim(), |j| (j * 255) as i32);
assert_equal(cloned(&a), x);
}
19 changes: 19 additions & 0 deletions tests/par_azip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,22 @@ fn test_indices_1()
});
assert_eq!(count.load(Ordering::SeqCst), a1.len());
}

#[test]
fn test_par_azip9()
{
let mut a = Array::<i32, _>::zeros(62);
let b = Array::from_shape_fn(a.dim(), |j| j as i32);
let c = Array::from_shape_fn(a.dim(), |j| (j * 2) as i32);
let d = Array::from_shape_fn(a.dim(), |j| (j * 4) as i32);
let e = Array::from_shape_fn(a.dim(), |j| (j * 8) as i32);
let f = Array::from_shape_fn(a.dim(), |j| (j * 16) as i32);
let g = Array::from_shape_fn(a.dim(), |j| (j * 32) as i32);
let h = Array::from_shape_fn(a.dim(), |j| (j * 64) as i32);
let i = Array::from_shape_fn(a.dim(), |j| (j * 128) as i32);
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){
*a = b + c + d + e + f + g + h + i;
});
let x = Array::from_shape_fn(a.dim(), |j| (j * 255) as i32);
assert_equal(cloned(&a), x);
}
Loading