pub fn hstack_1d<T>(
arrays: &[ArrayView<'_, T, Ix1>],
) -> Result<Array<T, Ix2>, &'static str>
Expand description
Stack a sequence of 1D arrays horizontally (as columns) into a 2D array
§Arguments
arrays
- A slice of 1D arrays to stack
§Returns
A 2D array where each column contains an input array
§Examples
use ndarray::array;
use scirs2_core::ndarray_ext::manipulation::hstack_1d;
let a = array![1, 2, 3];
let b = array![4, 5, 6];
let stacked = hstack_1d(&[a.view(), b.view()]).unwrap();
assert_eq!(stacked.shape(), &[3, 2]);
assert_eq!(stacked, array![[1, 4], [2, 5], [3, 6]]);