tuple_transpose(3) tuple_transpose(3)

NAME

tuple_transpose - transpose tuple

SYNOPSIS

#include <cfl/tuple/functions/tuple_transpose.hpp>

// uses default permutation (here: spack <1,0>)
tuple_transpose <> (tuple (tuple (1,2), tuple (3,4))) ==
                    tuple (tuple (1,3), tuple (2,4));

// identity permutation
tuple_transpose <spack <0,1>>
(
    tuple (tuple (1,2), tuple (3,4))) ==
    tuple (tuple (1,2), tuple (3,4)
);

DESCRIPTION

Transpose tuple according to a permutation. The default is to swap the innermost (last) two dimensions. The permutation is expressed using a spack type. The tuple must be rectangular, and its dimension at least two.

RETURN VALUES

A tuple_view of the argument tuple, with dimensions rearranged according to the permutation.

STANDARDS

tuple_transpose is a container function.

NOTES

In CFL, there is no such notion as a one-dimensional row- or column tuple. Therefore one-dimensional tuples can not be transposed (as in for instance octave). Also, dimensionless tuples can not be transposed either.

The permutation argument is chosen to be expressed explicitly using one-line notation. This means the tuple rank and the permutation vector length must match, so the two arguments are not completely independent.

SEE ALSO

[pack(3)][]