Struct icu_segmenter::complex::lstm::matrix::MatrixOwned
source · pub(super) struct MatrixOwned<const D: usize> {
data: Vec<f32>,
dims: [usize; D],
}
Expand description
A D
-dimensional, heap-allocated matrix.
This matrix implementation supports slicing matrices into tightly-packed
submatrices. For example, indexing into a matrix of size 5x4x3 returns a
matrix of size 4x3. For more information, see MatrixOwned::submatrix
.
Fields§
§data: Vec<f32>
§dims: [usize; D]
Implementations§
source§impl<const D: usize> MatrixOwned<D>
impl<const D: usize> MatrixOwned<D>
pub(super) fn as_borrowed(&self) -> MatrixBorrowed<'_, D>
pub(super) fn new_zero(dims: [usize; D]) -> Self
sourcepub(super) fn submatrix<const M: usize>(
&self,
index: usize,
) -> Option<MatrixBorrowed<'_, M>>
pub(super) fn submatrix<const M: usize>( &self, index: usize, ) -> Option<MatrixBorrowed<'_, M>>
Returns the tightly packed submatrix at index, or None
if index is out of range.
For example, if the matrix is 5x4x3, this function returns a matrix sized 4x3. If the matrix is 4x3, then this function returns a linear matrix of length 3.
The type parameter M
should be D - 1
.
pub(super) fn as_mut(&mut self) -> MatrixBorrowedMut<'_, D>
sourcepub(super) fn submatrix_mut<const M: usize>(
&mut self,
index: usize,
) -> Option<MatrixBorrowedMut<'_, M>>
pub(super) fn submatrix_mut<const M: usize>( &mut self, index: usize, ) -> Option<MatrixBorrowedMut<'_, M>>
A mutable version of Self::submatrix
.
Trait Implementations§
source§impl<const D: usize> Clone for MatrixOwned<D>
impl<const D: usize> Clone for MatrixOwned<D>
source§fn clone(&self) -> MatrixOwned<D>
fn clone(&self) -> MatrixOwned<D>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl<const D: usize> Freeze for MatrixOwned<D>
impl<const D: usize> RefUnwindSafe for MatrixOwned<D>
impl<const D: usize> Send for MatrixOwned<D>
impl<const D: usize> Sync for MatrixOwned<D>
impl<const D: usize> Unpin for MatrixOwned<D>
impl<const D: usize> UnwindSafe for MatrixOwned<D>
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