Function ndarray::stack [−][src]
pub fn stack<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, Axis};
let a = arr2(&[[2., 2.],
[3., 3.]]);
assert!(
stack(Axis(0), &[a.view(), a.view()])
== Ok(arr3(&[[[2., 2.],
[3., 3.]],
[[2., 2.],
[3., 3.]]]))
);