nums.numpy.swapaxes#

nums.numpy.swapaxes(a: nums.core.array.blockarray.BlockArray, axis1: int, axis2: int)#

Interchange two axes of an array.

This docstring was copied from numpy.swapaxes.

Some inconsistencies with the NumS version may exist.

aBlockArray

Input array.

axis1int

First axis.

axis2int

Second axis.

a_swappedBlockArray

For NumPy >= 1.10.0, if a is an BlockArray, then a view of a is returned; otherwise a new array is created. For earlier NumPy versions a view of a is returned only if the order of the axes is changed, otherwise the input array is returned.

The doctests shown below are copied from NumPy. They won’t show the correct result until you operate get().

>>> x = nps.array([[1,2,3]])  
>>> nps.swapaxes(x,0,1).get()  
array([[1],
       [2],
       [3]])
>>> x = nps.array([[[0,1],[2,3]],[[4,5],[6,7]]])  
>>> x.get()  
array([[[0, 1],
        [2, 3]],
       [[4, 5],
        [6, 7]]])
>>> nps.swapaxes(x,0,2).get()  
array([[[0, 4],
        [2, 6]],
       [[1, 5],
        [3, 7]]])