@@ -13,40 +13,6 @@ use crate::dimension;
1313use crate :: error:: { from_kind, ErrorKind , ShapeError } ;
1414use crate :: imp_prelude:: * ;
1515
16- /// Stack arrays along the new axis.
17- ///
18- /// ***Errors*** if the arrays have mismatching shapes.
19- /// ***Errors*** if `arrays` is empty, if `axis` is out of bounds,
20- /// if the result is larger than is possible to represent.
21- ///
22- /// ```
23- /// extern crate ndarray;
24- ///
25- /// use ndarray::{arr2, arr3, stack, Axis};
26- ///
27- /// # fn main() {
28- ///
29- /// let a = arr2(&[[2., 2.],
30- /// [3., 3.]]);
31- /// assert!(
32- /// stack(Axis(0), &[a.view(), a.view()])
33- /// == Ok(arr3(&[[[2., 2.],
34- /// [3., 3.]],
35- /// [[2., 2.],
36- /// [3., 3.]]]))
37- /// );
38- /// # }
39- /// ```
40- pub fn stack < A , D > ( axis : Axis , arrays : & [ ArrayView < A , D > ] ) -> Result < Array < A , D :: Larger > , ShapeError >
41- where
42- A : Clone ,
43- D : Dimension ,
44- D :: Larger : RemoveAxis ,
45- {
46- #[ allow( deprecated) ]
47- stack_new_axis ( axis, arrays)
48- }
49-
5016/// Concatenate arrays along the given axis.
5117///
5218/// ***Errors*** if the arrays have mismatching shapes, apart from along `axis`.
10672 Ok ( res)
10773}
10874
109- #[ deprecated( note = "Use under the name stack instead." , since = "0.15.0" ) ]
11075/// Stack arrays along the new axis.
11176///
11277/// ***Errors*** if the arrays have mismatching shapes.
@@ -116,22 +81,22 @@ where
11681/// ```
11782/// extern crate ndarray;
11883///
119- /// use ndarray::{arr2, arr3, stack_new_axis , Axis};
84+ /// use ndarray::{arr2, arr3, stack , Axis};
12085///
12186/// # fn main() {
12287///
12388/// let a = arr2(&[[2., 2.],
12489/// [3., 3.]]);
12590/// assert!(
126- /// stack_new_axis (Axis(0), &[a.view(), a.view()])
91+ /// stack (Axis(0), &[a.view(), a.view()])
12792/// == Ok(arr3(&[[[2., 2.],
12893/// [3., 3.]],
12994/// [[2., 2.],
13095/// [3., 3.]]]))
13196/// );
13297/// # }
13398/// ```
134- pub fn stack_new_axis < A , D > ( axis : Axis , arrays : & [ ArrayView < A , D > ] ) -> Result < Array < A , D :: Larger > , ShapeError >
99+ pub fn stack < A , D > ( axis : Axis , arrays : & [ ArrayView < A , D > ] ) -> Result < Array < A , D :: Larger > , ShapeError >
135100where
136101 A : Clone ,
137102 D : Dimension ,
@@ -259,36 +224,3 @@ macro_rules! concatenate {
259224 $crate:: concatenate( $axis, & [ $( $crate:: ArrayView :: from( & $array) ) ,* ] ) . unwrap( )
260225 } ;
261226}
262-
263- /// Stack arrays along the new axis.
264- ///
265- /// Uses the [`stack_new_axis()`] function, calling `ArrayView::from(&a)` on each
266- /// argument `a`.
267- ///
268- /// ***Panics*** if the `stack` function would return an error.
269- ///
270- /// ```
271- /// extern crate ndarray;
272- ///
273- /// use ndarray::{arr2, arr3, stack_new_axis, Axis};
274- ///
275- /// # fn main() {
276- ///
277- /// let a = arr2(&[[2., 2.],
278- /// [3., 3.]]);
279- /// assert!(
280- /// stack_new_axis![Axis(0), a, a]
281- /// == arr3(&[[[2., 2.],
282- /// [3., 3.]],
283- /// [[2., 2.],
284- /// [3., 3.]]])
285- /// );
286- /// # }
287- /// ```
288- #[ macro_export]
289- #[ deprecated( note = "Use under the name stack instead." , since = "0.15.0" ) ]
290- macro_rules! stack_new_axis {
291- ( $axis: expr, $( $array: expr ) ,+ ) => {
292- $crate:: stack_new_axis( $axis, & [ $( $crate:: ArrayView :: from( & $array) ) ,* ] ) . unwrap( )
293- } ;
294- }
0 commit comments