Skip to main content

StridedDynArray

Type Alias StridedDynArray 

Source
pub type StridedDynArray<Item, const NDIM: usize> = Array<StridedBaseArray<VectorContainer<Item>, NDIM>, NDIM>;
Expand description

A heap-allocated array with an explicit non-overlapping stride.

Logical iteration remains column-major even when the physical storage layout is not.

Aliased Type§

pub struct StridedDynArray<Item, const NDIM: usize>(/* private fields */);

Implementations§

Source§

impl<Item: Copy + Default, const NDIM: usize> StridedDynArray<Item, NDIM>

Source

pub fn from_shape_and_stride( shape: [usize; NDIM], stride: [usize; NDIM], ) -> Self

Allocate an array with an explicit physical stride.

The allocation spans through the greatest reachable storage offset. Strides must map every logical index to a distinct storage element.

§Panics

Panics if two computed logical offsets are equal. Shape/stride arithmetic uses ordinary usize operations, so callers must provide metadata whose products, offsets, and storage span are representable.

Source§

impl<Item, const NDIM: usize> StridedDynArray<Item, NDIM>
where Item: Copy + Default,

Source

pub fn new_from<ArrayImpl>( stride: [usize; NDIM], arr: &Array<ArrayImpl, NDIM>, ) -> Self
where ArrayImpl: UnsafeRandom1DAccessByValue<Item = Item> + Shape<NDIM>,

Create a new strided array with stride and fill with values from arr.

Source

pub fn row_major_from<ArrayImpl>(arr: &Array<ArrayImpl, NDIM>) -> Self
where ArrayImpl: UnsafeRandom1DAccessByValue<Item = Item> + Shape<NDIM>,

Create a new row-major array from existing array arr.