tuple_transpose(3) | tuple_transpose(3) |
tuple_transpose - transpose tuple
#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)
);
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.
A tuple_view
of the argument tuple, with dimensions rearranged according to
the permutation.
tuple_transpose
is a container function.
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.
[pack(3)][]