Transpose

is an ambivalent primitive function which reorders the axes of the right argument array. The name Transpose comes from the fact that monadic application to a matrix yields its transpose. The dyadic usage is sometimes called Rearrange Axes, which better reflects the behavior of the function.

Monadic usage
Monadic Transpose reverses the axes of the right argument. When applied to a matrix, the result is its transpose. Scalar and vector arguments are unaffected.

Dyadic usage
For dyadic usage, the left argument X must be a vector whose length equals the rank of the right argument Y, and the elements must form a range so that  is satisfied.

If all values in X are unique (X forms a permutation over the axes of Y), the axes are reordered by X so that N-th element of X specifies the new position for the N-th axis of Y. This means that, given a multi-dimensional index V of an element in the resulting array,  corresponds to.

When X contains duplicates, the result has rank. For the axes of Y that map to the same resulting axis, only the elements where the indices are equal over those axes are collected. This has the effect of extracting diagonal elements. If the axes are of unequal length, the resulting axis has the length of the shortest of them. This operation can be modeled as computing the resulting shape, then creating the array of its multi-dimensional indices  , then modify each index and fetch the corresponding elements of Y.

Documentation

 * Dyalog monadic, dyadic
 * APLX
 * J Dictionary, NuVoc