#include "tensorstore/index_space/dim_expression.h"
template <typename Indices>
auto tensorstore::DimExpression<Op...>::IndexSlice(
    
const Indicesindices) const;

Extracts a single-index slice of the selected dimensions using the specified index vector.

Given k selected_dimensions, an indices vector of size k, and an existing_transform with input rank m, the new index transform maps input vectors of size m - k to:

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 y is any index in [2, 5].

Requires:

Indices satisfies 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 indices vector 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.