Function ndarray::stack_new_axis

source ·
pub fn stack_new_axis<A, D>(
    axis: Axis,
    arrays: &[ArrayView<'_, A, D>]
) -> Result<Array<A, D::Larger>, ShapeError>where
    A: Clone,
    D: Dimension,
    D::Larger: RemoveAxis,
👎Deprecated since 0.15.0: Use under the name stack instead.
Expand description

Stack arrays along the new axis.

Errors if the arrays have mismatching shapes. Errors if arrays is empty, if axis is out of bounds, if the result is larger than is possible to represent.

extern crate ndarray;

use ndarray::{arr2, arr3, stack_new_axis, Axis};


let a = arr2(&[[2., 2.],
               [3., 3.]]);
assert!(
    stack_new_axis(Axis(0), &[a.view(), a.view()])
    == Ok(arr3(&[[[2., 2.],
                  [3., 3.]],
                 [[2., 2.],
                  [3., 3.]]]))
);