Function ndarray::stack [] [src]

pub fn stack<'a, A, D>(axis: Axis, arrays: &[ArrayView<'a, A, D>]) -> Result<OwnedArray<A, D>, ShapeError> where A: Copy, D: RemoveAxis

Stack arrays along the given axis.

Errors if the arrays don't all have the same dimension (may be made more flexible in the future).
Errors if arrays is empty, if axis is out of bounds, if the result is larger than is possible to represent.

use ndarray::{arr2, Axis, stack};

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