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

Transforms a dimension order for the output space of transform to a corresponding dimension order for the input 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 input_perm is simply mapped from output_perm according to this correspondence, and TransformInputDimensionOrder computes the inverse.

More generally, a dimension input_dim in input_perm is ordered ascending by the first index j for which the output dimension output_perm[j] maps to input_dim via a OutputIndexMethod::single_input_dimension output index map, and then by dimension index. Input dimensions with no corresponding output dimension are ordered last.

Parameters:
IndexTransformView<> transform

The index transform.

span<const DimensionIndex> output_perm

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

out
span<DimensionIndex> input_perm

Pointer to array of length transform.input_rank().