#include "tensorstore/index_space/dim_expression.h"
auto tensorstore::DimExpression<Op...>::Transpose() const;

Transposes the input dimensions such that the selected dimensions are consecutive.

This is equivalent to MoveToFront() and MoveToBack(), but requires that all dimensions are selected. The new dimension selection is {0, ..., input_rank-1}.

For example, Dims(2, 0, 1).Transpose() has the following effects:

Before

After

Dimension selection

{2, 0, 1}

{0, 1, 2}

Input domain

[1*, 3], [2, 5*], [3, 4]

[3, 4], [1*, 3], [2, 5*]

Labels

{"x", "y", "z"}

{"z", "x", "y"}

Equivalent input indices

{2, 3, 4}

{4, 2, 3}

Equivalent input indices

{x, y, z}

{z, x, y}

where x is any index in [1, 3], y is any index in [2, 5], and z is any index in [3, 4].

Requires:

The static rank of the dimension selection must be compatible with the static input rank.

Error absl::StatusCode::kInvalidArgument:

if the rank of the dimension selection is not equal to the input rank.