Skip to content

Commit 7b1e2af

Browse files
authored
Merge pull request #5 from espdev/fix-into-shape
Use into_shape instead of into_shape_with_order to fix memory layout errors
2 parents d7c3f99 + bfd4617 commit 7b1e2af

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/ndarrayext.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn to_2d<'a, T: 'a, D, I>(data: I, axis: Axis) -> Result<ArrayView2<'a, T>>
4646
let axis_size = shape[axis.0];
4747
let new_shape = [numel / axis_size, axis_size];
4848

49-
match data_view.permuted_axes(axes).into_shape_with_order(new_shape) {
49+
match data_view.permuted_axes(axes).into_shape(new_shape) {
5050
Ok(view_2d) => Ok(view_2d),
5151
Err(error) => Err(
5252
ReshapeTo2d {
@@ -68,7 +68,7 @@ pub fn to_2d_simple<'a, T: 'a, D>(data: ArrayView<'a, T, D>) -> Result<ArrayView
6868
let shape = data.shape().to_vec();
6969
let new_shape = [shape[0..(ndim - 1)].iter().product(), shape[ndim - 1]];
7070

71-
match data.into_shape_with_order(new_shape) {
71+
match data.into_shape(new_shape) {
7272
Ok(data_2d) => Ok(data_2d),
7373
Err(error) => Err(
7474
ReshapeTo2d {
@@ -98,7 +98,7 @@ pub fn from_2d<'a, T: 'a, D, S, I>(data: I, shape: S, axis: Axis) -> Result<Arra
9898
let new_shape: D = dim_from_vec(ndim, new_shape_vec.clone());
9999
let data_view = data.into();
100100

101-
match data_view.into_shape_with_order(new_shape) {
101+
match data_view.into_shape(new_shape) {
102102
Ok(view_nd) => {
103103
let mut axes_tmp: Vec<usize> = (0..ndim).collect();
104104
let end_axis = axes_tmp.pop().unwrap();

src/ndg/evaluate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl<'a, T, D> NdGridSpline<'a, T, D>
4747
let shape: D = dim_from_vec(self.ndim, coeffs_shape);
4848

4949
coeffs_2d
50-
.into_shape_with_order(shape).unwrap()
50+
.into_shape(shape).unwrap()
5151
.permuted_axes(permuted_axes.clone())
5252
.to_owned()
5353
};

src/ndg/make.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<'a, T, D> GridCubicSmoothingSpline<'a, T, D>
6666
let new_shape: D = dim_from_vec(ndim, coeffs_shape);
6767

6868
spline.coeffs()
69-
.into_shape_with_order(new_shape).unwrap()
69+
.into_shape(new_shape).unwrap()
7070
.permuted_axes(permuted_axes.clone())
7171
.to_owned()
7272
};

0 commit comments

Comments
 (0)