File tree Expand file tree Collapse file tree 1 file changed +4
-20
lines changed Expand file tree Collapse file tree 1 file changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -2752,17 +2752,11 @@ where
2752
2752
A : ' a ,
2753
2753
S : Data ,
2754
2754
{
2755
- let view_len = self . len_of ( axis) ;
2756
- let view_stride = self . strides . axis ( axis) ;
2757
- if view_len == 0 {
2755
+ if self . len_of ( axis) == 0 {
2758
2756
let new_dim = self . dim . remove_axis ( axis) ;
2759
2757
Array :: from_shape_simple_fn ( new_dim, move || mapping ( ArrayView :: from ( & [ ] ) ) )
2760
2758
} else {
2761
- // use the 0th subview as a map to each 1d array view extended from
2762
- // the 0th element.
2763
- self . index_axis ( axis, 0 ) . map ( |first_elt| unsafe {
2764
- mapping ( ArrayView :: new_ ( first_elt, Ix1 ( view_len) , Ix1 ( view_stride) ) )
2765
- } )
2759
+ Zip :: from ( self . lanes ( axis) ) . map_collect ( mapping)
2766
2760
}
2767
2761
}
2768
2762
@@ -2783,21 +2777,11 @@ where
2783
2777
A : ' a ,
2784
2778
S : DataMut ,
2785
2779
{
2786
- let view_len = self . len_of ( axis) ;
2787
- let view_stride = self . strides . axis ( axis) ;
2788
- if view_len == 0 {
2780
+ if self . len_of ( axis) == 0 {
2789
2781
let new_dim = self . dim . remove_axis ( axis) ;
2790
2782
Array :: from_shape_simple_fn ( new_dim, move || mapping ( ArrayViewMut :: from ( & mut [ ] ) ) )
2791
2783
} else {
2792
- // use the 0th subview as a map to each 1d array view extended from
2793
- // the 0th element.
2794
- self . index_axis_mut ( axis, 0 ) . map_mut ( |first_elt| unsafe {
2795
- mapping ( ArrayViewMut :: new_ (
2796
- first_elt,
2797
- Ix1 ( view_len) ,
2798
- Ix1 ( view_stride) ,
2799
- ) )
2800
- } )
2784
+ Zip :: from ( self . lanes_mut ( axis) ) . map_collect ( mapping)
2801
2785
}
2802
2786
}
2803
2787
You can’t perform that action at this time.
0 commit comments