next up previous contents
Next: Specifications of Extended Library Up: Specifications of Extended Intrinsic Previous: TRANSPOSE(ARRAYORDER)

TRANSPOSE(ARRAY,ORDER)

 

Optional Argument. ORDER

Description. Permute the axes (a generalized transpose) of an array.

Class. Transformational function.

Arguments.

ARRAY may be of any type, and must be array valued.

ORDER (optional) must be of type integer, rank one, and of size equal to the rank of ARRAY. Its elements must be a permutation of (1,2,...,n), where n is RANK(ARRAY).

Result Type, Type Parameters, and Shape. The result is an array of the same rank, type, and type parameters as ARRAY. Its shape satisfies the relation RS(ORDER) == AS, where RS is the shape of the result and AS is SHAPE(ARRAY). If ORDER is absent, it defaults to (n,n-1,...1), where n is RANK(ARRAY).

Result value. Element (j1,j2,...,jn) of the result is ARRAY (jorder(1),jorder(2),...,jorder(n)).

Examples. For an array of rank two, TRANSPOSE(ARRAY) is the usual matrix transpose.

If ARRAY has shape [1 2 3]

                   /             \
and ARRAY(1,:,:) is | 111 112 113 |
                   | 121 122 123 |
                   \             /
and ORDER is [3 1 2] then the shape of the result is [2 3 1]; if R is the result then R(:,:,1) is equal to ARRAY(1,:,:). The rule is that axis i of ARRAY becomes axis ORDER(i) of the result.


next up previous contents
Next: Specifications of Extended Library Up: Specifications of Extended Intrinsic Previous: TRANSPOSE(ARRAYORDER)