-
#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 oneinput
index vector such thattransform(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:
All output index maps:
are
OutputIndexMethod::constant
maps or have astride
of0
, orare
OutputIndexMethod::single_input_dimension
maps with astride
of1
or-1
.
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, orfalse
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 storedindex_range
interval; the actual indices in the index array do not affect the result. Furthermore, even if the index array happens to densely cover theindex_range
interval, the computed output range will still be considered not to be exact, and the return value will befalse
.