Skip to content

Commit 9b23ba5

Browse files
authored
Merge pull request #937 from rust-ndarray/deprecated-stack-new-axis
Deprecate stack_new_axis (Use stack)
2 parents b5687f8 + abcea8a commit 9b23ba5

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/doc/ndarray_for_numpy_users/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,8 @@
530530
//! ------|-----------|------
531531
//! `a[:] = 3.` | [`a.fill(3.)`][.fill()] | set all array elements to the same scalar value
532532
//! `a[:] = b` | [`a.assign(&b)`][.assign()] | copy the data from array `b` into array `a`
533-
//! `np.concatenate((a,b), axis=1)` | [`stack![Axis(1), a, b]`][stack!] or [`stack(Axis(1), &[a.view(), b.view()])`][stack()] | concatenate arrays `a` and `b` along axis 1
534-
//! `np.stack((a,b), axis=1)` | [`stack_new_axis![Axis(1), a, b]`][stack_new_axis!] or [`stack_new_axis(Axis(1), vec![a.view(), b.view()])`][stack_new_axis()] | stack arrays `a` and `b` along axis 1
533+
//! `np.concatenate((a,b), axis=1)` | [`concatenate![Axis(1), a, b]`][concatenate!] or [`concatenate(Axis(1), &[a.view(), b.view()])`][concatenate()] | concatenate arrays `a` and `b` along axis 1
534+
//! `np.stack((a,b), axis=1)` | [`stack![Axis(1), a, b]`][stack!] or [`stack(Axis(1), vec![a.view(), b.view()])`][stack()] | stack arrays `a` and `b` along axis 1
535535
//! `a[:,np.newaxis]` or `np.expand_dims(a, axis=1)` | [`a.insert_axis(Axis(1))`][.insert_axis()] | create an array from `a`, inserting a new axis 1
536536
//! `a.transpose()` or `a.T` | [`a.t()`][.t()] or [`a.reversed_axes()`][.reversed_axes()] | transpose of array `a` (view for `.t()` or by-move for `.reversed_axes()`)
537537
//! `np.diag(a)` | [`a.diag()`][.diag()] | view the diagonal of `a`
@@ -585,6 +585,8 @@
585585
//! [.ncols()]: ../../struct.ArrayBase.html#method.ncols
586586
//! [.column()]: ../../struct.ArrayBase.html#method.column
587587
//! [.column_mut()]: ../../struct.ArrayBase.html#method.column_mut
588+
//! [concatenate!]: ../../macro.concatenate.html
589+
//! [concatenate()]: ../../fn.concatenate.html
588590
//! [CowArray]: ../../type.CowArray.html
589591
//! [::default()]: ../../struct.ArrayBase.html#method.default
590592
//! [.diag()]: ../../struct.ArrayBase.html#method.diag
@@ -641,8 +643,6 @@
641643
//! [.shape()]: ../../struct.ArrayBase.html#method.shape
642644
//! [stack!]: ../../macro.stack.html
643645
//! [stack()]: ../../fn.stack.html
644-
//! [stack_new_axis!]: ../../macro.stack_new_axis.html
645-
//! [stack_new_axis()]: ../../fn.stack_new_axis.html
646646
//! [.strides()]: ../../struct.ArrayBase.html#method.strides
647647
//! [.index_axis()]: ../../struct.ArrayBase.html#method.index_axis
648648
//! [.sum_axis()]: ../../struct.ArrayBase.html#method.sum_axis

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ pub use crate::arraytraits::AsArray;
151151
pub use crate::linalg_traits::NdFloat;
152152
pub use crate::linalg_traits::LinalgScalar;
153153

154+
#[allow(deprecated)] // stack_new_axis
154155
pub use crate::stacking::{concatenate, stack, stack_new_axis};
155156

156157
pub use crate::math_cell::MathCell;

src/stacking.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ where
4343
D: Dimension,
4444
D::Larger: RemoveAxis,
4545
{
46+
#[allow(deprecated)]
4647
stack_new_axis(axis, arrays)
4748
}
4849

@@ -108,6 +109,7 @@ where
108109
}
109110
}
110111

112+
#[deprecated(note="Use under the name stack instead.", since="0.15.0")]
111113
/// Stack arrays along the new axis.
112114
///
113115
/// ***Errors*** if the arrays have mismatching shapes.
@@ -273,6 +275,7 @@ macro_rules! concatenate {
273275
/// # }
274276
/// ```
275277
#[macro_export]
278+
#[deprecated(note="Use under the name stack instead.", since="0.15.0")]
276279
macro_rules! stack_new_axis {
277280
($axis:expr, $( $array:expr ),+ ) => {
278281
$crate::stack_new_axis($axis, &[ $($crate::ArrayView::from(&$array) ),* ]).unwrap()

0 commit comments

Comments
 (0)