pub struct Mat<S>where
S: Scalar,{ /* private fields */ }Expand description
Extremely basic matrix type, written as Mat<S>, short for “matrix”.
§Implementation Details
- The underlying data structure is a
Vec<S>. - This matrix implementation is row-major; the elements of the matrix are stored row-by-row
in a one-dimensional “flat” data structure (in this case a
Vec<S>).
§Motivation
Rust does not have a matrix type in the std library, and users of this crate may not want to
have dependencies such as nalgebra, ndarray, and/or faer.
Implementations§
Trait Implementations§
Source§impl<S> IntoIterator for Mat<S>where
S: Scalar,
impl<S> IntoIterator for Mat<S>where
S: Scalar,
Source§impl<S> Matrix<S> for Mat<S>where
S: Scalar,
impl<S> Matrix<S> for Mat<S>where
S: Scalar,
Source§type VectorM = Vec<S>
type VectorM = Vec<S>
Length-
M Vector type implementing the crate::Vector trait that is compatible with this
matrix type. An instance of this matrix type with shape (M, N) can be multiplied from the
left by an instance of this vector type with length M, resulting in an instance of this
vector type with length N (mathematically representing a row vector).Source§type VectorN = Vec<S>
type VectorN = Vec<S>
Length-
N Vector type implementing the crate::Vector trait that is compatible with this
matrix type. An instance of this matrix type with shape (M, N) can be multiplied from the
right by an instance of this vector type with length N, resulting in an instance of this
vector type with length M (mathematically representing a column vector).Source§fn is_statically_sized() -> bool
fn is_statically_sized() -> bool
Determine whether or not the matrix is statically-sized. Read more
Source§fn is_dynamically_sized() -> bool
fn is_dynamically_sized() -> bool
Determine whether or not the matrix is dynamically-sized. Read more
Source§fn is_row_major() -> bool
fn is_row_major() -> bool
Determine whether or not the matrix is row-major. Read more
Source§fn is_column_major() -> bool
fn is_column_major() -> bool
Determine whether or not the matrix is column-major. Read more
Source§fn new_with_shape(rows: usize, cols: usize) -> Self
fn new_with_shape(rows: usize, cols: usize) -> Self
Create a matrix with the specified size, with each element set to 0. Read more
Source§fn from_row_slice(rows: usize, cols: usize, slice: &[S]) -> Self
fn from_row_slice(rows: usize, cols: usize, slice: &[S]) -> Self
Create a matrix from a slice of scalars arranged in row-major order. Read more
Source§fn from_col_slice(rows: usize, cols: usize, slice: &[S]) -> Self
fn from_col_slice(rows: usize, cols: usize, slice: &[S]) -> Self
Create a matrix from a slice of scalars arranged in column-major order. Read more
Source§fn as_slice<'a>(&'a self) -> Cow<'a, [S]>
fn as_slice<'a>(&'a self) -> Cow<'a, [S]>
Return a slice view of the matrix’s elements. Read more
Source§fn add_assign(&mut self, other: &Self)
fn add_assign(&mut self, other: &Self)
In-place matrix addition (elementwise) (
self += other). Read moreSource§fn sub_assign(&mut self, other: &Self)
fn sub_assign(&mut self, other: &Self)
In-place matrix subtraction (elementwise) (
self -= other). Read moreSource§fn mul_assign(&mut self, scalar: S)
fn mul_assign(&mut self, scalar: S)
Source§fn div_assign(&mut self, scalar: S)
fn div_assign(&mut self, scalar: S)
In-place matrix-scalar division (
self / scalar). Read moreSource§fn new_vector_n(&self) -> Self::VectorN
fn new_vector_n(&self) -> Self::VectorN
Source§fn new_vector_m(&self) -> Self::VectorM
fn new_vector_m(&self) -> Self::VectorM
Source§fn assert_same_shape(&self, other: &Self)
fn assert_same_shape(&self, other: &Self)
Assert that this matrix and another matrix have the same shape. Read more
impl<S> StructuralPartialEq for Mat<S>where
S: Scalar,
Auto Trait Implementations§
impl<S> Freeze for Mat<S>
impl<S> RefUnwindSafe for Mat<S>where
S: RefUnwindSafe,
impl<S> Send for Mat<S>where
S: Send,
impl<S> Sync for Mat<S>where
S: Sync,
impl<S> Unpin for Mat<S>where
S: Unpin,
impl<S> UnwindSafe for Mat<S>where
S: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.