Skip to content

strata::Permute

Part of Views and expressions.

template <tensor_like E, std::size_t... Permutation>
class strata::Permute;

E with its axes reordered: new axis k is axis Permutation[k] of the operand, so permuted[i, j] is operand[j, i] for Permutation = 1, 0.

What permute<Permutation...> gives for a node that has no permutation of its own: it reads through the operand, and its cursor is the operand's with the axes renumbered. A node with a better way, a view whose permutation is another view, gives that instead.

Template parameters

Name Description
E The operand as it is held, capture_t of what was given: borrowed for an lvalue owner, owned for a temporary one, which makes the permutation moved and never copied, else by value.
Permutation A permutation of 0 ... rank - 1.

Members

Permute

explicit constexpr Permute(E operand)

operand, its axes reordered.

operand

constexpr const E & operand() const noexcept STRATA_LIFETIMEBOUND

The operand that is permuted.

shape

constexpr shape_type shape() const

The operand's shape with its axes reordered.

cursor

constexpr auto cursor() const

Where a traversal starts: the operand's cursor, its axes renumbered.

operator[]

template <index_like... Indices>
constexpr value_type operator[](Indices... indices) const

The element at a position of the permuted tensor: the operand's, with the indices reordered.

Precondition

Each index is within the extent of its axis; the operand checks it.

permute

template <std::size_t... Outer>
constexpr auto permute(const Permute &permuted)

The permutation of the permutation: one permutation of the operand, and the operand itself where the two undo each other.