transpose
Permute the dimensions of an array. When called withoutaxes, reverses the dimension order. Returns a view (no data is copied).
Also available as np.linalg.transpose(...).
| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array. |
axes | number[] | undefined | Permutation of [0, 1, ..., N-1] where N is the number of dimensions. If omitted, the axes are reversed. |
NDArray — View of a with its axes permuted.
swapaxes
Interchange two axes of an array. Returns a view.| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array. |
axis1 | number | — | First axis. |
axis2 | number | — | Second axis. |
NDArray — View of a with the two specified axes swapped.
moveaxis
Move axes of an array to new positions. Other axes remain in their original order. Returns a view.| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array. |
source | number | number[] | — | Original position(s) of the axes to move. |
destination | number | number[] | — | Target position(s) for each axis. |
NDArray — View of a with the specified axes moved.
rollaxis
Roll the specified axis backwards until it lies at the given position. Returns a view.| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array. |
axis | number | — | The axis to roll. |
start | number | 0 | The axis is rolled until it lies before this position. |
NDArray — View of a with the axis rolled to the target position.
permute_dims
Permute the dimensions of an array. This is the Array API-compatible equivalent oftranspose.
Also available as np.linalg.permute_dims(...).
| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array. |
axes | number[] | — | Permutation of dimensions. |
NDArray — View of a with its axes permuted.
matrix_transpose
Transpose the last two dimensions of an array. The input must have at least 2 dimensions. Returns a view. Also available asnp.linalg.matrix_transpose(...).
| Name | Type | Default | Description |
|---|---|---|---|
a | ArrayLike | — | Input array with ndim >= 2. |
NDArray — View of a with the last two axes swapped.