#include "tensorstore/index_space/dim_expression.h"
template <typename Start, typename Size, typename Strides = Index>
auto tensorstore::DimExpression<Op...>::SizedInterval(
    
const Startstart,
    
const Sizesize,
    
const Stridesstrides = 1) const;

Extracts a sized interval from the selected dimensions with optional striding.

The domain of each selected dimension is transformed by ExtractSizedStridedSlice using the corresponding components of the start, size, and strides vectors. In the simple case that the stride component is 1, the new domain is simply restricted to the specified interval, with the new origin equal to the specified start component. In the general case with a stide component not equal to 1, the new origin is equal to the start component divided by the strides component, rounded towards zero; in this case, the TranslateSizedInterval operation, which ensures an origin of 0, may be more convenient.

The new dimension selection is the same as the prior dimension selection, with a static rank equal to the merged static rank of the prior dimension selection and the static extents of the start, size, and strides vectors.

For example: Dims(0, 2).SizedInterval({1, 8}, {3, 2}, {1, -2}) has the following effects:

Before

After

Dimension selection

{0, 2}

{0, 2}

Input domain

[0, 6], [2, 5], [0, 9]

[1, 3], [2, 5], [-4, -3]

Labels

{"x", "y", "z"}

{"x", "y", "z"}

Equivalent input indices

{2, 3, 6}

{2, 3, -3}

Equivalent input indices

{x, y, z * -2}

{x, y, z}

where x is any index in [1, 3], y is any index in [2, 5], and z is any index in [-4, -3].

Requires:

Start, Size, and Strides satisfy the IsIndexVectorOrScalar concept with static extents compatible with each other and with the static rank of the dimension selection.

Parameters:
const Start &start

The index vector specifying the start indices for each selected dimension. May be a braced list, e.g. {1, 2, 3}. May also be a scalar, e.g. 5, in which case the same start index is used for all selected dimensions.

const Size &size

The size vector specifying the size of the domain for each selected dimension. May be a braced list or scalar.

const Strides &strides = 1

The index vector specifying the stride value for each selected dimension. May be a braced list or scalar. If not specified, defaults to 1.

Error absl::StatusCode::kInvalidArgument:

if the extents of the start, size, or strides vectors do not match the number of selected dimensions.

Error absl::StatusCode::kInvalidArgument:

or absl::StatusCode::kOutOfRange if the start, size, and strides values are invalid or specify a slice outside the effective bounds for a given dimension (implicit lower/upper bounds are treated as -/+inf).

Error absl::StatusCode::kInvalidArgument:

if integer overflow occurs when computing the resultant transform.