-
#include "tensorstore/index_space/dim_expression.h" -
template <typename Start, typename Size, typename Strides = Index>
auto tensorstore::DimExpression<Op...>::SizedInterval(
const Start& start,
const Size& size,
const Strides& strides = 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, andstridesvectors. In the simple case that the stride component is1, the new domain is simply restricted to the specified interval, with the new origin equal to the specifiedstartcomponent. In the general case with a stide component not equal to1, the new origin is equal to thestartcomponent divided by thestridescomponent, rounded towards zero; in this case, theTranslateSizedIntervaloperation, 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, andstridesvectors.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
xis any index in[1, 3],yis any index in[2, 5], andzis any index in[-4, -3].- Requires:¶
Start,Size, andStridessatisfy 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, orstridesvectors do not match the number of selected dimensions.- Error absl::StatusCode::kInvalidArgument:¶
or
absl::StatusCode::kOutOfRangeif thestart,size, andstridesvalues 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.