#include "tensorstore/index_space/dimension_permutation.h"
void tensorstore::TransformInputDimensionOrder(
    
IndexTransformView<> transform,
    
span<const DimensionIndex> input_perm,
    
span<DimensionIndex> output_perm);

Transforms a dimension order for the input space of transform to a corresponding dimension order for the output space of transform.

If there is a one-to-one onto correspondence between output dimensions and input dimensions via OutputIndexMethod::single_input_dimension output index maps, then output_perm is simply mapped from input_perm according to this correspondence, and TransformOutputDimensionOrder computes the inverse.

More generally, each output dimension output_dim mapped with a OutputIndexMethod::single_input_dimension map is ordered ascending by inv(input_perm)[output_dim], and then by dimension index. Output dimensions without a OutputIndexMethod::single_input_dimension map are ordered last, and then by dimension index.

Parameters:
IndexTransformView<> transform

The index transform.

span<const DimensionIndex> input_perm

Permutation of {0, 1, ..., transform.input_rank()-1}.

out
span<DimensionIndex> output_perm

Pointer to array of length transform.output_rank().