#include "tensorstore/index_space/index_transform.h"
Result<bool>
tensorstore::GetOutputRange(IndexTransformView<> transform,
                            
MutableBoxView<> output_range);

Computes a hyperrectangle bound on the output range of transform.

In some cases, the computed bound is exactly equal to the range of the transform, meaning for every position output in the computed bounding box, there is at least one input index vector such that transform(input) == output. In other cases, the computed bound is merely a superset of the range of the transform.

The computed bound is exact if, and only if, the following two conditions are satisfied:

  1. All output index maps:

    1. are OutputIndexMethod::constant maps or have a stride of 0, or

    2. are OutputIndexMethod::single_input_dimension maps with a stride of 1 or -1.

  2. No two OutputIndexMethod::single_input_dimension output index maps depend on the same input dimension (meaning an input dimension correspond to the diagonal of two or more output dimensions).

Parameters:
IndexTransformView<> transform

The index transform for which to compute the output range.

out
MutableBoxView<> output_range

Reference to box of rank transform.output_rank().

Dchecks:

transform.output_rank() == output_range.rank().

Returns:

true if the computed bound is guaranteed to be exact, or false if the actual range may be a sparse subset of the computed bound.

Error absl::StatusCode::kInvalidArgument:

if the transform is invalid.

Error absl::StatusCode::kInvalidArgument:

if integer overflow occurs while computing the result.

Warning

For efficiency, in the case of an OutputIndexMethod::array output index map, the output range is computed based solely on the stored index_range interval; the actual indices in the index array do not affect the result. Furthermore, even if the index array happens to densely cover the index_range interval, the computed output range will still be considered not to be exact, and the return value will be false.