-
#include "tensorstore/index_space/index_domain.h"
-
template <DimensionIndex InputRank,
DimensionIndex OutputRank,
ContainerKind OtherCKind>
Result<IndexTransform<InputRank, OutputRank, container>>
tensorstore::IndexDomain<Rank, CKind>::operator()(
IndexTransform<InputRank, OutputRank, OtherCKind> transform)
const; Slices an index transform by this index domain.
Equivalent to applying
Dims(dims).SizedInterval(this->origin(), this->shape())
totransform
, wheredims
is a dimension index vector of lengththis->rank()
computed according to one of two cases:- M1. At least one of
this
ortransform
is entirely unlabeled (all dimension labels are empty). In this case,
dims[i] = i
for alli
. It is an error ifthis->rank() != transform.input_rank()
. Iftransform
is entirely unlabeled, the returned transform has the labels ofthis->labels()
, which is equivalent to chaining a call to.Label(this->labels())
after the call toDimExpression::SizedInterval
.- M2. Both
this
andtransform
have at least one labeled dimension. In this case, each corresponding dimension
dims[i]
oftransform
is determined as follows:If dimension
i
ofthis
has a non-empty label,dims[i] = k
, wherek
is the dimension oftransform
for whichtransform.input_labels()[k] == labels()[i]
. It is an error if no such dimension exists.Otherwise,
i
is thej
th unlabeled dimension of*this
(left to right), anddims[i] = k
, wherek
is thej
th unlabeled dimension oftransform
(left to right). It is an error if no such dimension exists.
If any dimensions of
*this
are unlabeled, then it is an error ifthis->rank() != transform.input_rank()
. This condition is not strictly necessary but serves to avoid a discrepancy in behavior withAlignDomainTo
.
The bounds of this index domain must be contained within the existing domain of
transform
.All unlabeled dimensions example
transform:
[0, 5), [1, 7)
domain:
[2, 4), [3, 6)
result:
[2, 4), [3, 6)
Fully labeled dimensions example
transform:
"x": [0, 5), "y": [1, 7), "z": [2, 8)
domain:
"y": [2, 6), "x": [3, 4)
result:
"x": [3, 4), "y": [2, 6), "z": [2, 8)
Mixed labeled and unlabeled dimensions example
transform:
"x": [0, 10), "": [0, 10), "": [0, 10), "y": [0, 10)
domain:
"y": [1, 6), "": [2, 7), "x": [3, 8), "": [4, 9)
result:
"x": [3, 8), "": [2, 7), "": [4, 9), "y": [1, 6)
- Parameters:¶
- IndexTransform<InputRank, OutputRank, OtherCKind> transform¶
The transform to slice..
- Returns:¶
The sliced transform.
- Error absl::StatusCode::kInvalidArgument:¶
if dimension matching fails.
- Error absl::StatusCode::kOutOfRange:¶
if the bounds of dimension
i
ofthis
are not contained within the effective bounds (ignoring implicit bounds) of the corresponding dimensionj
oftransform
.
- M1. At least one of