-
#include "tensorstore/index_space/dim_expression.h" -
template <typename... IndexArray>
auto tensorstore::DimExpression<Op...>::OuterIndexArraySlice(
const IndexArray&... index_arrays) const; -
auto tensorstore::DimExpression<Op...>::OuterIndexArraySlice(
span<const SharedArrayView<const Index>> index_arrays) const; Independently slices the selected dimensions using index arrays.
Each of the
k = sizeof...(IndexArray)selected_dimensionscorrespond to anindex_array. Given anexisting_transformwith input rankm, the new index transform has an input rankp = m + sum((index_array.rank() - 1)...) - 1, there is a listidentity_dimsof input dimensions and for eachselected_dimensions[i], a separate listarray_dims.[i]ofindex_array.[i].rank()consecutive input dimensions such that:flatten(interleave(identity_dims, selected_dimensions, {array_dims...})) == 0:p.The new transform maps
inputvectors of sizepto:existing_transform( interleave( input[identity_dims], selected_dimensions, {index_array(input[array_dims])...}))The domain of the new input dimension
array_dims.[i][j]is[0, index_array.[i].size(j)). The new dimension selection isflatten({array_dims...}).For example:
Dims(2, 0).OuterIndexArraySlice(MakeArray<Index>({{2, 3}, {4, 5}}), MakeArray<Index>({6, 7}))has the following effects:
Before
After
Dim. selection
{2, 0}{2, 3, 0}Input domain
[4, 8], [2, 5], [0, 9][0, 1], [2, 5], [0, 1], [0, 1]Labels
{"x", "y", "z"}{"", "y", "", ""}Equivalent inputs
{6, 3, 3}{0, 3, 0, 1}Equivalent inputs
{7, 3, 4}{1, 3, 1, 0}Equivalent inputs
{xi(a), y, zi(b,c)}{a, y, b, c}where
yis any index in[2, 5],ais any index in[0, 1],bis any index in[0, 1],cis any index in[0, 1],xi = MakeArray<Index>({6, 7}andzi = MakeArray<Index>({{2, 3}, {4, 5}}).- Requires:¶
(IsIndexArray<IndexArray> && ...)- Requires:¶
sizeof...(IndexArray)must be compatible with the static rank of the dimension selection.- Parameters:¶
- const IndexArray&... index_arrays¶
- span<const SharedArrayView<const Index>> index_arrays
The index arrays used to index into each selected dimension. The new transform may share ownership of the supplied index arrays. The index arrays should not be modified after being passed to this function. The index values contained in the index arrays may be bounds-checked lazily. May also be specified as a
span.
- Error absl::StatusCode::kInvalidArgument:¶
if
sizeof...(IndexArray)is not equal to the number of selected dimensions.- Error absl::StatusCode::kOutOfRange:¶
if an out-of-bounds index is detected. error
absl::StatusCode::kInvalidArgumentif integer overflow occurs when computing the resultant transform.