pub fn stack_2d<T>(
arrays: &[ArrayView<'_, T, Ix2>],
axis: usize,
) -> Result<Array<T, Ix2>, &'static str>
Expand description
Stack 2D arrays along a given axis
§Arguments
arrays
- A slice of 2D arrays to stackaxis
- The axis along which to stack (0 for rows, 1 for columns)
§Returns
A new array containing the stacked arrays
§Examples
use ndarray::{array, Axis};
use scirs2_core::ndarray_ext::stack_2d;
let a = array![[1, 2], [3, 4]];
let b = array![[5, 6], [7, 8]];
let c = stack_2d(&[a.view(), b.view()], 0).unwrap();
assert_eq!(c.shape(), &[4, 2]);