-
#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, wheredimsis a dimension index vector of lengththis->rank()computed according to one of two cases:- M1. At least one of
thisortransformis entirely unlabeled (all dimension labels are empty). In this case,
dims[i] = ifor alli. It is an error ifthis->rank() != transform.input_rank(). Iftransformis 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
thisandtransformhave at least one labeled dimension. In this case, each corresponding dimension
dims[i]oftransformis determined as follows:If dimension
iofthishas a non-empty label,dims[i] = k, wherekis the dimension oftransformfor whichtransform.input_labels()[k] == labels()[i]. It is an error if no such dimension exists.Otherwise,
iis thejth unlabeled dimension of*this(left to right), anddims[i] = k, wherekis thejth unlabeled dimension oftransform(left to right). It is an error if no such dimension exists.
If any dimensions of
*thisare 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
iofthisare not contained within the effective bounds (ignoring implicit bounds) of the corresponding dimensionjoftransform.
- M1. At least one of