Navigation

Operators and Keywords

Function List:

C++ API

: permute (A, perm)

Return the generalized transpose for an N-D array object A.

The permutation vector perm must contain the elements 1:ndims (A) (in any order, but each element must appear only once). The Nth dimension of A gets remapped to dimension PERM(N). For example:

x = zeros ([2, 3, 5, 7]);
size (x)
  ⇒  2   3   5   7

size (permute (x, [2, 1, 3, 4]))
  ⇒  3   2   5   7

size (permute (x, [1, 3, 4, 2]))
  ⇒  2   5   7   3

## The identity permutation
size (permute (x, [1, 2, 3, 4]))
  ⇒  2   3   5   7

See also: ipermute.

Package: octave