Skip to content

Commit 1c87a36

Browse files
committed
Add methods .rows() .columns()
1 parent 3381bb2 commit 1c87a36

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/impl_linalg.rs

+10
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ impl<A, S> ArrayBase<S, (Ix, Ix)>
140140
self.subview_mut(Axis(0), index)
141141
}
142142

143+
/// Return the number of rows (length of `Axis(0)`) in the two-dimensional array.
144+
pub fn rows(&self) -> Ix {
145+
self.shape().axis(Axis(0))
146+
}
147+
143148
/// Return an array view of column `index`.
144149
///
145150
/// **Panics** if `index` is out of bounds.
@@ -157,6 +162,11 @@ impl<A, S> ArrayBase<S, (Ix, Ix)>
157162
self.subview_mut(Axis(1), index)
158163
}
159164

165+
/// Return the number of columns (length of `Axis(1)`) in the two-dimensional array.
166+
pub fn columns(&self) -> Ix {
167+
self.shape().axis(Axis(1))
168+
}
169+
160170
/// Perform matrix multiplication of rectangular arrays `self` and `rhs`.
161171
///
162172
/// The array shapes must agree in the way that

0 commit comments

Comments
 (0)