nlcpy.swapaxes
- nlcpy.swapaxes(a, axis1, axis2)[ソース]
Interchanges two axes of an array.
- Parameters
- aarray_like
Input array.
- axis1int
First axis.
- axis2int
Second axis.
- Returns
- a_swappedndarray
If a is an ndarray, then a view of a is returned; otherwise a new array is created.
Examples
>>> import nlcpy as vp >>> x = vp.array([[1, 2, 3]]) >>> vp.swapaxes(x, 0, 1) array([[1], [2], [3]]) >>> x = vp.array([[[0,1],[2,3]],[[4,5],[6,7]]]) >>> x array([[[0, 1], [2, 3]], [[4, 5], [6, 7]]]) >>> vp.swapaxes(x,0,2) array([[[0, 4], [2, 6]], [[1, 5], [3, 7]]])