Struct n_array::NArray
[−]
[src]
pub struct NArray<T> { pub dimensions: usize, pub magnitudes: Vec<usize>, pub data: Vec<T>, }
An arbitrary n-dimensional array. Dimensions is the number of dimensions, magnitudes contains the size of each dimension, and data contains the data for the array.
Fields
dimensions: usize
magnitudes: Vec<usize>
data: Vec<T>
Methods
impl<T> NArray<T>
[src]
fn from_function<F>(dim: usize, mag: &[usize], func: F) -> Self where
F: Fn(&[usize]) -> T,
F: Fn(&[usize]) -> T,
Returns a new NArray, with each index populated by a function of it's coordinates.)
impl<T: Default> NArray<T>
[src]
fn new(dim: usize, mag: &[usize]) -> Self
Returns a new NArray, with each index populated by the default for a given type.
Trait Implementations
impl<T: Debug> Debug for NArray<T>
[src]
impl<T: Clone> Clone for NArray<T>
[src]
fn clone(&self) -> NArray<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<T, S: AsRef<[usize]>> Index<S> for NArray<T>
[src]
type Output = T
The returned type after indexing
fn index(&self, index: S) -> &Self::Output
The method for the indexing (container[index]
) operation
impl<T, S: AsRef<[usize]>> IndexMut<S> for NArray<T>
[src]
fn index_mut(&mut self, index: S) -> &mut Self::Output
The method for the mutable indexing (container[index]
) operation