Struct forust_ml::data::RowMajorMatrix
source · 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> 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