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>

source

pub(super) fn as_borrowed(&self) -> MatrixBorrowed<'_, D>

source

pub(super) fn new_zero(dims: [usize; D]) -> Self

source

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.

source

pub(super) fn as_mut(&mut self) -> MatrixBorrowedMut<'_, D>

source

pub(super) fn submatrix_mut<const M: usize>( &mut self, index: usize, ) -> Option<MatrixBorrowedMut<'_, M>>

A mutable version of Self::submatrix.

source§

impl<'a> MatrixOwned<1>

source

pub(super) fn dim(&self) -> usize

source§

impl<'a> MatrixOwned<2>

source

pub(super) fn dim(&self) -> (usize, usize)

source§

impl<'a> MatrixOwned<3>

source

pub(super) fn dim(&self) -> (usize, usize, usize)

Trait Implementations§

source§

impl<const D: usize> Clone for MatrixOwned<D>

source§

fn clone(&self) -> MatrixOwned<D>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<const D: usize> Debug for MatrixOwned<D>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto 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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T