We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0a3b95f commit 8dde517Copy full SHA for 8dde517
src/numeric/impl_numeric.rs
@@ -139,13 +139,12 @@ where
139
let mut res = Array::ones(self.raw_dim());
140
let mut acc = Array::ones(self.raw_dim().remove_axis(axis));
141
142
- // Use fold_axis approach
143
- for i in 0..self.len_of(axis) {
144
- // Get view of current slice along axis, and update accumulator element-wise multiplication
145
- let view = self.index_axis(axis, i);
146
- acc = acc * &view;
147
- res.index_axis_mut(axis, i).assign(&acc);
148
- }
+ Zip::from(self.axis_iter(axis))
+ .and(res.axis_iter_mut(axis))
+ .for_each(|view, mut res| {
+ acc = acc.clone() * &view;
+ res.assign(&acc);
+ });
149
150
res
151
}
0 commit comments