DynArray

Type Alias DynArray 

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

A basic dynamically allocated array.

Aliased Type§

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

Implementations§

Source§

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

Source

pub fn from_shape(shape: [usize; NDIM]) -> Self

Create a new heap allocated array from a given shape.

Source

pub fn from_shape_and_vec(shape: [usize; NDIM], data: Vec<Item>) -> Self

Create a new heap allocated array by providing a shape and a vector of data.

The number of elements in the vector must be compatible with the given shape. Otherwise, an assertion error is triggered.

Source§

impl<Item: Copy + Default> DynArray<Item, 2>

Source

pub fn from_iter_aij<Iter: Iterator<Item = ([usize; 2], Item)>>( shape: [usize; 2], iter: Iter, ) -> DynArray<Item, 2>

Create a new dense matrix with shape shape filled with values from the iterator iter.

Source§

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

Source

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

Create a new array and fill with values from arr.

Trait Implementations§

Source§

impl<Item: Copy + Default> From<&[Item]> for DynArray<Item, 1>

Source§

fn from(value: &[Item]) -> Self

Converts to this type from the input type.
Source§

impl<Item: Copy + Default> From<Vec<Item>> for DynArray<Item, 1>

Source§

fn from(value: Vec<Item>) -> Self

Converts to this type from the input type.
Source§

impl<Item: Copy + Default> From<Vec<Vec<Item>>> for DynArray<Item, 2>

Source§

fn from(value: Vec<Vec<Item>>) -> Self

Converts to this type from the input type.