-
#include "tensorstore/index_space/dim_expression.h" -
template <typename Indices>
auto tensorstore::DimExpression<Op...>::IndexSlice(
const Indices& indices) const; Extracts a single-index slice of the selected dimensions using the specified index vector.
Given
kselected_dimensions, anindicesvector of sizek, and anexisting_transformwith input rankm, the new index transform mapsinputvectors of sizem - kto:existing_transform(interleave(input, selected_dimensions, indices))The selected dimensions are removed from the new index space, and the new dimension selection is empty. Dimensions that are not selected are retained.
For example:
Dims(0, 2).IndexSlice({2, 4})has the following effects:Before
After
Dimension selection
{0, 2}{}Input domain
[1, 3], [2, 5], [3, 4][2, 5]Labels
{"x", "y", "z"}{"y"}Equivalent input indices
{2, 3, 4}{3}Equivalent input indices
{2, y, 4}{y}where
yis any index in[2, 5].- Requires:¶
Indicessatisfies the IsIndexVectorOrScalar concept with a static extent compatible with the static rank of the dimension selection.- Parameters:¶
- const Indices &indices¶
The index vector specifying the index to slice from each selected dimension. May be a braced list, e.g.
IndexSlice({1, 2, 3}). May also be a scalar, e.g.IndexSlice(5), in which case the same index is used for all selected dimensions.
- Error absl::StatusCode::kInvalidArgument:¶
if the extent of the
indicesvector is not equal to the number of selected dimensions.- Error absl::StatusCode::kOutOfRange:¶
if the index value for a given input dimension is outside its effective domain (implicit lower/upper bounds are treated as -/+inf).
- Error absl::StatusCode::kInvalidArgument:¶
if integer overflow occurs when computing the resultant transform.