pub struct Mat<T> { /* private fields */ }Implementations§
Source§impl<T> Mat<T>
impl<T> Mat<T>
pub fn new(rows: usize, cols: usize, values: Vec<T>, col_major: bool) -> Self
pub fn from_fn( rows: usize, cols: usize, f: impl Fn(usize, usize) -> T, col_major: bool, ) -> Self
pub fn zeros(rows: usize, cols: usize, col_major: bool) -> Self
pub fn ones(rows: usize, cols: usize, col_major: bool) -> Self
pub fn identity(n: usize, col_major: bool) -> Self
pub fn with_diagonal(diag: &[T], col_major: bool) -> Self
pub fn rows(&self) -> usize
pub fn cols(&self) -> usize
pub fn shape(&self) -> (usize, usize)
pub fn values(&self) -> &[T]
pub fn values_mut(&mut self) -> &mut [T]
pub fn col_major(&self) -> bool
pub fn values_vec(self) -> Vec<T>
pub fn get_ref(&self, row: usize, col: usize) -> &T
pub fn get_ref_mut(&mut self, row: usize, col: usize) -> &mut T
pub fn row(&self, row: usize) -> impl Iterator<Item = &T>
pub fn col(&self, col: usize) -> impl Iterator<Item = &T>
Sourcepub fn row_slice_mut(&mut self, row: usize) -> &mut [T]
pub fn row_slice_mut(&mut self, row: usize) -> &mut [T]
Panics if not in row-major order.
Sourcepub fn col_slice_mut(&mut self, col: usize) -> &mut [T]
pub fn col_slice_mut(&mut self, col: usize) -> &mut [T]
Panics if not in column-major order.
Sourcepub fn row_iter_mut(&mut self) -> impl Iterator<Item = &mut [T]>
pub fn row_iter_mut(&mut self) -> impl Iterator<Item = &mut [T]>
Panics if not in row-major order.
Sourcepub fn col_iter_mut(&mut self) -> impl Iterator<Item = &mut [T]>
pub fn col_iter_mut(&mut self) -> impl Iterator<Item = &mut [T]>
Panics if not in column-major order.
pub fn select_rows(&self, rows: &[usize], col_major: bool) -> Selfwhere
T: Clone,
pub fn select_cols(&self, cols: &[usize]) -> Self
pub fn diagonal(&self) -> impl Iterator<Item = &T>
pub fn mat_vec(&self, b: &[T]) -> Vec<T>
pub fn mat_mat(&self, b: &Self) -> Self
Trait Implementations§
Source§impl<T> AddAssign<T> for Mat<T>
impl<T> AddAssign<T> for Mat<T>
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
Performs the
+= operation. Read moreSource§impl<T> AddAssign for Mat<T>
impl<T> AddAssign for Mat<T>
Source§fn add_assign(&mut self, rhs: Mat<T>)
fn add_assign(&mut self, rhs: Mat<T>)
Performs the
+= operation. Read moreSource§impl<T> DivAssign<T> for Mat<T>
impl<T> DivAssign<T> for Mat<T>
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/= operation. Read moreSource§impl<T> DivAssign for Mat<T>
impl<T> DivAssign for Mat<T>
Source§fn div_assign(&mut self, rhs: Mat<T>)
fn div_assign(&mut self, rhs: Mat<T>)
Performs the
/= operation. Read moreSource§impl<T> MulAssign<T> for Mat<T>
impl<T> MulAssign<T> for Mat<T>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*= operation. Read moreSource§impl<T> MulAssign for Mat<T>
impl<T> MulAssign for Mat<T>
Source§fn mul_assign(&mut self, rhs: Mat<T>)
fn mul_assign(&mut self, rhs: Mat<T>)
Performs the
*= operation. Read moreAuto Trait Implementations§
impl<T> Freeze for Mat<T>
impl<T> RefUnwindSafe for Mat<T>where
T: RefUnwindSafe,
impl<T> Send for Mat<T>where
T: Send,
impl<T> Sync for Mat<T>where
T: Sync,
impl<T> Unpin for Mat<T>where
T: Unpin,
impl<T> UnwindSafe for Mat<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