pub fn transpose_2d<T>(array: ArrayView<'_, T, Ix2>) -> Array<T, Ix2>where
T: Clone,
Expand description
Swap axes (transpose) of a 2D array
§Arguments
array
- The input 2D array
§Returns
A view of the input array with the axes swapped
§Examples
ⓘ
use ndarray::array;
use scirs2_core::ndarray_ext::transpose_2d;
let a = array![[1, 2, 3], [4, 5, 6]];
let b = transpose_2d(a.view());
assert_eq!(b.shape(), &[3, 2]);
assert_eq!(b[[0, 0]], 1);
assert_eq!(b[[0, 1]], 4);