-
#include "tensorstore/index_space/dim_expression.h" -
template <typename TargetDimensions>
auto tensorstore::DimExpression<Op...>::Transpose(
const TargetDimensions& target_dimensions) const; Transposes the input dimensions such that the selected dimensions have the specified indices. Dimensions not in the selection retain their relative order and fill in the dimension indices not in
target_dimensions.The new dimension selection is equal to
target_dimensionsafter normalization.For example,
Dims(2, 0).Transpose({1, 2})has the following effects:Before
After
Dimension selection
{2, 0}{1, 2}Input domain
[1*, 3], [2, 5*], [3, 4][2, 5*], [3, 4], [1*, 3]Labels
{"x", "y", "z"}{"y", "z", "x"}Equivalent input indices
{2, 3, 4}{3, 4, 2}Equivalent input indices
{x, y, z}{y, z, x}where
xis any index in[1, 3],yis any index in[2, 5], andzis any index in[3, 4].- Requires:¶
TargetDimensionsisspan-compatible with aspan::value_typeofDimensionIndexand a static extent compatible with the static rank of the dimension selection.- Parameters:¶
- const TargetDimensions &target_dimensions¶
The new dimension indices corresponding to each selected dimension. May be a braced list, e.g.
Transpose({1, 2}). A negative value of-nis equivalent toinput_rank - n, whereinput_rankis the input rank of the transform to which this operation is applied.
- Error absl::StatusCode::kInvalidArgument:¶
if the rank of the dimension selection is not equal to the length of
target_dimensions, or if the indices intarget_dimensionsare not unique or outside the valid range.