-
#include "tensorstore/array.h"
-
template <typename Element,
DimensionIndex Rank,
ArrayOriginKind OriginKind,
ContainerKind CKind>
SharedArray<Element, Rank, OriginKind> tensorstore::AllocateArrayLike(
const StridedLayout<Rank, OriginKind, CKind>& layout,
IterationConstraints constraints = c_order,
ElementInitialization initialization = default_init,
dtype_t<Element> dtype = dtype_v<Element>); Allocates an array with a layout similar to an existing strided layout.
The newly allocated array has the same
Array::domain
aslayout
.- Parameters:¶
- const StridedLayout<Rank, OriginKind, CKind> &layout¶
The existing strided layout.
- IterationConstraints constraints = c_order¶
If
constraints.has_order_constraint()
, the returned array will useconstraints.order_constraint_value()
. Otherwise, an order will be chosen such that the byte strides of the allocated array have the same order (with respect to their absolute values) aslayout.byte_strides()
.- ElementInitialization initialization = default_init¶
Specifies the initialization type.
- dtype_t<Element> dtype = dtype_v<Element>¶
Specifies the element type (optional if
Element
is non-void
).