pub struct Mat<T: ReprOwned> { /* private fields */ }Expand description
An owning matrix that manages its own memory.
The matrix stores raw bytes interpreted according to representation type T.
Memory is automatically deallocated when the matrix is dropped.
Implementations§
Source§impl<T: ReprOwned> Mat<T>
impl<T: ReprOwned> Mat<T>
Sourcepub fn new<U>(repr: T, init: U) -> Result<Self, <T as NewOwned<U>>::Error>where
T: NewOwned<U>,
pub fn new<U>(repr: T, init: U) -> Result<Self, <T as NewOwned<U>>::Error>where
T: NewOwned<U>,
Create a new matrix using init as the initializer.
Sourcepub fn num_vectors(&self) -> usize
pub fn num_vectors(&self) -> usize
Returns the number of rows (vectors) in the matrix.
Sourcepub fn get_row(&self, i: usize) -> Option<T::Row<'_>>
pub fn get_row(&self, i: usize) -> Option<T::Row<'_>>
Returns the ith row if i < self.num_vectors().
Sourcepub fn get_row_mut(&mut self, i: usize) -> Option<T::RowMut<'_>>
pub fn get_row_mut(&mut self, i: usize) -> Option<T::RowMut<'_>>
Returns the ith mutable row if i < self.num_vectors().
Sourcepub fn as_view_mut(&mut self) -> MatMut<'_, T>
pub fn as_view_mut(&mut self) -> MatMut<'_, T>
Returns a mutable view of the matrix.
Sourcepub fn as_raw_ptr(&self) -> *const u8
pub fn as_raw_ptr(&self) -> *const u8
Return the base pointer for the Mat.
Trait Implementations§
Source§impl<'this, T: ReprOwned> ReborrowMut<'this> for Mat<T>
impl<'this, T: ReprOwned> ReborrowMut<'this> for Mat<T>
impl<T> Send for Mat<T>
impl<T> Sync for Mat<T>
Auto Trait Implementations§
impl<T> Freeze for Mat<T>where
T: Freeze,
impl<T> RefUnwindSafe for Mat<T>where
T: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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