File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,28 @@ fn test_zip_collect() {
97
97
assert_abs_diff_eq ! ( a, & b + & c, epsilon = 1e-6 ) ;
98
98
assert_eq ! ( a. strides( ) , b. strides( ) ) ;
99
99
}
100
+
101
+ }
102
+
103
+ #[ test]
104
+ #[ cfg( feature = "approx" ) ]
105
+ fn test_zip_small_collect ( ) {
106
+ use approx:: assert_abs_diff_eq;
107
+
108
+ for m in 0 ..32 {
109
+ for n in 0 ..16 {
110
+ let dim = ( m, n) ;
111
+ let b = Array :: from_shape_fn ( dim, |( i, j) | 1. / ( i + 2 * j + 1 ) as f32 ) ;
112
+ let c = Array :: from_shape_fn ( dim, |( i, j) | f32:: ln ( ( 1 + i + j) as f32 ) ) ;
113
+
114
+ {
115
+ let a = Zip :: from ( & b) . and ( & c) . par_apply_collect ( |x, y| x + y) ;
116
+
117
+ assert_abs_diff_eq ! ( a, & b + & c, epsilon = 1e-6 ) ;
118
+ assert_eq ! ( a. strides( ) , b. strides( ) ) ;
119
+ }
120
+ }
121
+ }
100
122
}
101
123
102
124
#[ test]
You can’t perform that action at this time.
0 commit comments