Reorder the axes of a nested array.
Numeric.shape.transpose(input, order, other, method)Reorders the axes of a nested array.
- Parameters:
input: Nested array to transposeorder: Axis order, swapped axis pair, or modeother: Second axis when swapping a pairmethod: Optional transposition mode
- Returns: Transposed array
- NumPy: Covers
np.transpose,np.permute_dims,np.matrix_transpose,np.swapaxes,np.moveaxis,np.rollaxis,np.linalg.matrix_transpose,ndarray.T,ndarray.transpose,ndarray.swapaxesthrough a single Numerix method.
import Numeric from '@neabyte/numerix'
const matrix = Numeric.shape.transpose([[1, 2], [3, 4]])
console.log(matrix)
// [[1,3],[2,4]]import Numeric from '@neabyte/numerix'
const matrix = Numeric.shape.transpose([[1, 2, 3], [4, 5, 6]], [1, 0])
console.log(matrix)
// [[1,4],[2,5],[3,6]]import Numeric from '@neabyte/numerix'
const matrix = Numeric.shape.transpose([[1, 2, 3], [4, 5, 6]], 0, 1)
console.log(matrix)
// [[1,4],[2,5],[3,6]]import Numeric from '@neabyte/numerix'
const matrix = Numeric.shape.transpose([[1, 2, 3]])
console.log(matrix)
// [[1],[2],[3]]