@@ -150,20 +150,19 @@ pub trait Dimension : Clone + Eq + Debug + Send + Sync + Default +
150150 strides
151151 }
152152
153- #[ doc( hidden) ]
154- // Return an index of same dimensionality
155- fn zero_index ( & self ) -> Self {
156- Self :: default ( )
157- }
158-
159- #[ doc( hidden) ]
160- /// Return an index of same type and with the specified dimensionality.
153+ /// Creates a dimension of all zeros with the specified ndim.
161154 ///
162155 /// This method is useful for generalizing over fixed-size and
163156 /// variable-size dimension representations.
164157 ///
165158 /// **Panics** if `Self` has a fixed size that is not `ndim`.
166- fn zero_index_with_ndim ( ndim : usize ) -> Self ;
159+ fn zeros ( ndim : usize ) -> Self ;
160+
161+ #[ doc( hidden) ]
162+ // Return an index of same dimensionality
163+ fn zero_index ( & self ) -> Self {
164+ Self :: default ( )
165+ }
167166
168167 #[ doc( hidden) ]
169168 #[ inline]
@@ -380,7 +379,7 @@ impl Dimension for Dim<[Ix; 0]> {
380379 #[ inline]
381380 fn into_pattern ( self ) -> Self :: Pattern { }
382381 #[ inline]
383- fn zero_index_with_ndim ( ndim : usize ) -> Self {
382+ fn zeros ( ndim : usize ) -> Self {
384383 assert_eq ! ( ndim, 0 ) ;
385384 Self :: default ( )
386385 }
@@ -416,7 +415,7 @@ impl Dimension for Dim<[Ix; 1]> {
416415 get ! ( & self , 0 )
417416 }
418417 #[ inline]
419- fn zero_index_with_ndim ( ndim : usize ) -> Self {
418+ fn zeros ( ndim : usize ) -> Self {
420419 assert_eq ! ( ndim, 1 ) ;
421420 Self :: default ( )
422421 }
@@ -510,7 +509,7 @@ impl Dimension for Dim<[Ix; 2]> {
510509 #[ inline]
511510 fn slice_mut ( & mut self ) -> & mut [ Ix ] { self . ixm ( ) }
512511 #[ inline]
513- fn zero_index_with_ndim ( ndim : usize ) -> Self {
512+ fn zeros ( ndim : usize ) -> Self {
514513 assert_eq ! ( ndim, 2 ) ;
515514 Self :: default ( )
516515 }
@@ -655,7 +654,7 @@ impl Dimension for Dim<[Ix; 3]> {
655654 }
656655
657656 #[ inline]
658- fn zero_index_with_ndim ( ndim : usize ) -> Self {
657+ fn zeros ( ndim : usize ) -> Self {
659658 assert_eq ! ( ndim, 3 ) ;
660659 Self :: default ( )
661660 }
@@ -764,7 +763,7 @@ macro_rules! large_dim {
764763 #[ inline]
765764 fn slice_mut( & mut self ) -> & mut [ Ix ] { self . ixm( ) }
766765 #[ inline]
767- fn zero_index_with_ndim ( ndim: usize ) -> Self {
766+ fn zeros ( ndim: usize ) -> Self {
768767 assert_eq!( ndim, $n) ;
769768 Self :: default ( )
770769 }
@@ -822,7 +821,7 @@ impl Dimension for IxDyn
822821 }
823822
824823 #[ inline]
825- fn zero_index_with_ndim ( ndim : usize ) -> Self {
824+ fn zeros ( ndim : usize ) -> Self {
826825 IxDyn :: zeros ( ndim)
827826 }
828827
0 commit comments