-
#include "tensorstore/index_space/dimension_identifier.h"
-
Result<DimensionIndex>
tensorstore::NormalizeDimensionIndex(DimensionIndex index,
DimensionIndex rank); Normalizes a dimension index in the range
(-rank, rank)
to the range[0, rank)
.- Parameters:¶
- DimensionIndex index¶
The dimension index to normalize. A negative
index
value is equivalent toindex + rank
(effectively counts from the last dimension).- DimensionIndex rank¶
The rank of the index space.
- Pre:¶
rank >= 0
- Returns:¶
- Error absl::StatusCode::kInvalidArgument:¶
if
index
is outside[-rank, rank)
.