Skip to content

Commit 3641ce5

Browse files
committed
Rename do_sub to do_collapse_axis
1 parent a4ab61d commit 3641ce5

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/dimension/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,18 @@ impl<'a> DimensionExt for [Ix]
197197
///
198198
/// **Panics** if `index` is larger than the size of the axis
199199
// FIXME: Move to Dimension trait
200-
pub fn do_sub<A, D: Dimension>(dims: &mut D, ptr: &mut *mut A, strides: &D,
201-
axis: usize, index: Ix) {
200+
pub fn do_collapse_axis<A, D: Dimension>(
201+
dims: &mut D,
202+
ptr: &mut *mut A,
203+
strides: &D,
204+
axis: usize,
205+
index: usize,
206+
) {
202207
let dim = dims.slice()[axis];
203208
let stride = strides.slice()[axis];
204209
ndassert!(index < dim,
205-
concat!("subview: Index {} must be less than axis length {} ",
206-
"for array with shape {:?}"),
210+
"collapse_axis: Index {} must be less than axis length {} for \
211+
array with shape {:?}",
207212
index, dim, *dims);
208213
dims.slice_mut()[axis] = 1;
209214
let off = stride_offset(index, stride);

src/impl_methods.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,13 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
591591
///
592592
/// **Panics** if `index` is past the length of the axis.
593593
pub fn collapse_axis(&mut self, axis: Axis, index: usize) {
594-
dimension::do_sub(&mut self.dim, &mut self.ptr, &self.strides,
595-
axis.index(), index)
594+
dimension::do_collapse_axis(
595+
&mut self.dim,
596+
&mut self.ptr,
597+
&self.strides,
598+
axis.index(),
599+
index,
600+
)
596601
}
597602

598603
/// Along `axis`, select the subview `index` and return a

0 commit comments

Comments
 (0)