uninitAlignedSlice

GC-Allocates an uninitialized aligned an n-dimensional slice.

@system
@optmath
uninitAlignedSlice
(
T
size_t N
)
(
size_t[N] lengths
,)

Parameters

lengths size_t[N]

list of lengths for each dimension

alignment uint

memory alignment (bytes)

Return Value

Type: auto

contiguous uninitialized n-dimensional slice

Examples

import mir.ndslice.slice: Slice;
auto tensor = uninitAlignedSlice!double([5, 6, 7], 64);
tensor[] = 0;
assert(tensor.length == 5);
assert(tensor.elementCount == 5 * 6 * 7);
assert(cast(size_t)(tensor.ptr) % 64 == 0);
static assert(is(typeof(tensor) == Slice!(double*, 3)));

Meta