logo
pub fn concatenate<A, D>(
    axis: Axis,
    arrays: &[ArrayView<'_, A, D>]
) -> Result<Array<A, D>, ShapeError> where
    A: Clone,
    D: RemoveAxis
Expand description

Concatenate arrays along the given axis.

Errors if the arrays have mismatching shapes, apart from along axis. (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, concatenate};

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