Function ndarray::stack_new_axis[][src]

pub fn stack_new_axis<A, D>(
    axis: Axis,
    arrays: &[ArrayView<'_, A, D>]
) -> Result<Array<A, D::Larger>, ShapeError> where
    A: Copy,
    D: Dimension,
    D::Larger: RemoveAxis
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.]]]))
);