Trait rds::array::NDData
[−]
[src]
pub trait NDData<T> { fn shape(&self) -> &[usize]; fn strides(&self) -> &[usize]; fn get_data(&self) -> &[T]; fn dim(&self) -> usize { ... } fn size(&self) -> usize { ... } fn idx<'a>(&'a self, idx: &[usize]) -> &'a T { ... } }
A trait for struture giving immutable access to a N-dimensional array of type T
Required Methods
fn shape(&self) -> &[usize]
Return a slice of length N where each element is the length of the dimension. For a 2 dimensional matrix, the first dimension is the number of rows and the second dimension is the number of columns.
fn strides(&self) -> &[usize]
Return a slice of length N where each element is the stride of the dimension.
fn get_data(&self) -> &[T]
Return the underlying storage array as a slice.
Provided Methods
fn dim(&self) -> usize
Return N, the number of dimensions.
fn size(&self) -> usize
Return the total number of element of the N-dimensional array.
fn idx<'a>(&'a self, idx: &[usize]) -> &'a T
Take a slice of length N representing an N-dimensional index in the array and return a reference to the element at this position.
Implementors
impl<T> NDData<T> for NDArray<T>
impl<'a, T> NDData<T> for NDSlice<'a, T>
impl<'a, T> NDData<T> for NDSliceMut<'a, T>