-
#include "tensorstore/index_space/index_transform.h" -
template <DimensionIndex Rank, ContainerKind CKind>
Result<IndexTransform<Rank, Rank>> tensorstore::InverseTransform(
const IndexTransform<Rank, Rank, CKind>& transform); Returns the inverse transform if one exists.
A transform is invertible if, and only if, the following criteria are met:
All output index maps are either:
OutputIndexMethod::single_input_dimension, with a stride of1or-1and a unique input dimension not referenced by any other output index map.
Every input dimension not referenced by a
OutputIndexMethod::single_input_dimensionoutput index map must be a “singleton dimension” with explicit lower/upper bounds and an extent of 1.
Note that
OutputIndexMethod::constantoutput index maps correspond to singleton input dimensions in the inverse transform, and vice versa. The labels of singleton input dimensions are not preserved.For example:
Given a
transformwith domain:"x": [1*, 5) "": [3, 4) "y": [2, 8*)and output index maps:
output[0] = 5 + -1 * input[2] output[1] = 3 + 1 * input[0], output[2] = 7the inverse transform has a domain of:
"y": [-2*, 4) "x": [ 4*, 8) "": [ 7, 8)and output index maps:
output[0] = -3 + input[1] output[1] = 3 output[2] = 5 + -1 * input[0]