-
#include "tensorstore/index_space/index_transform.h"
-
template <ArrayOriginKind OriginKind = offset_origin,
DimensionIndex InputRank,
DimensionIndex OutputRank,
ContainerKind CKind,
typename Array>
requires IsArray<Array> && (OutputRank == Array::static_rank)
Result<SharedArray<const typename Array::Element,
InputRank,
OriginKind>> tensorstore::
TransformArray(
const Array& array,
const IndexTransform<InputRank, OutputRank, CKind>& transform,
TransformArrayConstraints constraints =
skip_repeated_elements); Returns a strided array that represents the result of applying
transform
toarray
.- Template Parameters:¶
- ArrayOriginKind OriginKind = offset_origin¶
If equal to
offset_origin
(the default), the returned array will have anoffset_origin
and retain the resolved input origin. If equal tozero_origin
, the returned array will have azero_origin
.
- Parameters:¶
- const Array &array¶
The existing array to transform with
transform
.- const IndexTransform<InputRank, OutputRank, CKind> &transform¶
The index transform to apply to
array
.- TransformArrayConstraints constraints = skip_repeated_elements¶
Specifies constraints on the returned array, as the sum of an optional
MustAllocateConstraint
and an optionalIterationConstraints
value. If anMustAllocateConstraint
ofmay_allocate
is specified (which is the default), a view of the existingarray
will be returned if possible, and in this case ifArray::Pointer
is astd::shared_ptr
, the returned array will share ownership of the data. If the transformed array cannot be represented as a view of the existingarray
or if aMustAllocateConstraint
ofmust_allocate
is specified, a newly allocated array is returned, with a layout constrained by theIterationConstraints
, which defaults toskip_repeated_elements
.