Skip to content
Prev Previous commit
Apply examples changes from code review
Co-authored-by: Adam Reichold <[email protected]>
  • Loading branch information
bluss and adamreichold authored Mar 10, 2024
commit d32248df363590190452a1c70491bca357ae772b
3 changes: 1 addition & 2 deletions README-quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ row: [[100, 101, 102],
## Shape Manipulation

### Changing the shape of an array
The shape of an array can be changed with `into_shape_with_order` method.
(One can also use `to_shape` for this.)
The shape of an array can be changed with the `into_shape_with_order` or `to_shape` method.

````rust
use ndarray::prelude::*;
Expand Down
5 changes: 2 additions & 3 deletions src/impl_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1978,7 +1978,7 @@ where
/// elements is accepted, but the source array or view must be in standard
/// or column-major (Fortran) layout.
///
/// **Note** that `.into_shape_with_order()` "moves" elements differently depending on if the input array
/// **Note** that `.into_shape()` "moves" elements differently depending on if the input array
/// is C-contig or F-contig, it follows the index order that corresponds to the memory order.
/// Prefer to use `.to_shape()` or `.into_shape_with_order()`.
///
Expand All @@ -1992,7 +1992,7 @@ where
/// use ndarray::{aview1, aview2};
///
/// assert!(
/// aview1(&[1., 2., 3., 4.]).into_shape_with_order((2, 2)).unwrap()
/// aview1(&[1., 2., 3., 4.]).into_shape((2, 2)).unwrap()
/// == aview2(&[[1., 2.],
/// [3., 4.]])
/// );
Expand Down Expand Up @@ -2117,7 +2117,6 @@ where
A: Clone,
E: IntoDimension,
{
//return self.clone().into_shape_clone(shape).unwrap();
let shape = shape.into_dimension();
if size_of_shape_checked(&shape) != Ok(self.dim.size()) {
panic!(
Expand Down