pub struct RowMajorMatrix<T> {
pub data: Vec<T>,
pub rows: usize,
pub cols: usize,
/* private fields */
}Expand description
A lightweight row major matrix, this is primarily for returning data to the user, it is especially suited for appending rows to, such as when building up a matrix of data to return to the user, the added benefit is it will be even faster to return to numpy.
Fields§
§data: Vec<T>§rows: usize§cols: usizeImplementations§
Source§impl<T> RowMajorMatrix<T>
impl<T> RowMajorMatrix<T>
pub fn new(data: Vec<T>, rows: usize, cols: usize) -> Self
Sourcepub fn get(&self, i: usize, j: usize) -> &T
pub fn get(&self, i: usize, j: usize) -> &T
Get a single reference to an item in the matrix.
i- The ith row of the data to get.j- the jth column of the data to get.
Sourcepub fn append_row(&mut self, items: Vec<T>)
pub fn append_row(&mut self, items: Vec<T>)
Add a rows to the matrix, this can be multiple rows, if they are in sequential order in the items.
Trait Implementations§
Source§impl<T: Debug> Debug for RowMajorMatrix<T>
impl<T: Debug> Debug for RowMajorMatrix<T>
Source§impl<'de, T> Deserialize<'de> for RowMajorMatrix<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for RowMajorMatrix<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<T> Freeze for RowMajorMatrix<T>
impl<T> RefUnwindSafe for RowMajorMatrix<T>where
T: RefUnwindSafe,
impl<T> Send for RowMajorMatrix<T>where
T: Send,
impl<T> Sync for RowMajorMatrix<T>where
T: Sync,
impl<T> Unpin for RowMajorMatrix<T>where
T: Unpin,
impl<T> UnwindSafe for RowMajorMatrix<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more