Struct SMatrix
pub struct SMatrix<T, const M: usize, const N: usize> { /* private fields */ }
Expand description
Statically sized matrix.
SMatrix is used almost just like Matrix, but its size is known at compile-time,
so operations can be done without the &
operator. The size of this matrix cannot be changed.
§Example
let mut mat_a: SMatrix<i32, 3, 3> = SMatrix::one();
mat_a = mat_a * 2;
mat_a[1] = [1,2,3];
assert_eq!(mat_a, smatrix!{{2,0,0},{1,2,3},{0,0,2}});
Implementations§
§impl<T, const M: usize, const N: usize> SMatrix<T, M, N>where
T: Copy,
Methods for matrices with general dimensions.
impl<T, const M: usize, const N: usize> SMatrix<T, M, N>where
T: Copy,
Methods for matrices with general dimensions.
pub fn new(init: T) -> SMatrix<T, M, N>
pub fn new(init: T) -> SMatrix<T, M, N>
Creates new Matrix
§Example
let mut mat_a: SMatrix<i32, 3, 3> = SMatrix::new(1_i32);
mat_a[1] = [1, 2, 3];
assert_eq!(mat_a[1], [1, 2, 3]);
assert_eq!(mat_a[1][1], 2);
let mat_b = smatrix!{1, 1, 1; 1, 1, 1; 1, 1, 1;};
let mat_c: SMatrix<u32, 3, 3> = SMatrix::new(1);
assert_eq!(mat_b, mat_c);
Trait Implementations§
§impl<T, const M: usize, const N: usize> AddAssign for SMatrix<T, M, N>
impl<T, const M: usize, const N: usize> AddAssign for SMatrix<T, M, N>
§fn add_assign(&mut self, rhs: SMatrix<T, M, N>)
fn add_assign(&mut self, rhs: SMatrix<T, M, N>)
Performs the
+=
operation. Read more§impl<T, const M: usize, const N: usize> DivAssign<T> for SMatrix<T, M, N>
impl<T, const M: usize, const N: usize> DivAssign<T> for SMatrix<T, M, N>
§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/=
operation. Read more§impl<T, const M: usize, const N: usize> MulAssign<T> for SMatrix<T, M, N>
impl<T, const M: usize, const N: usize> MulAssign<T> for SMatrix<T, M, N>
§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*=
operation. Read more§impl<T, const M: usize, const N: usize> SubAssign for SMatrix<T, M, N>
impl<T, const M: usize, const N: usize> SubAssign for SMatrix<T, M, N>
§fn sub_assign(&mut self, rhs: SMatrix<T, M, N>)
fn sub_assign(&mut self, rhs: SMatrix<T, M, N>)
Performs the
-=
operation. Read moreimpl<T: Copy, const M: usize, const N: usize> Copy for SMatrix<T, M, N>
impl<T, const M: usize, const N: usize> StructuralPartialEq for SMatrix<T, M, N>
Auto Trait Implementations§
impl<T, const M: usize, const N: usize> Freeze for SMatrix<T, M, N>where
T: Freeze,
impl<T, const M: usize, const N: usize> RefUnwindSafe for SMatrix<T, M, N>where
T: RefUnwindSafe,
impl<T, const M: usize, const N: usize> Send for SMatrix<T, M, N>where
T: Send,
impl<T, const M: usize, const N: usize> Sync for SMatrix<T, M, N>where
T: Sync,
impl<T, const M: usize, const N: usize> Unpin for SMatrix<T, M, N>where
T: Unpin,
impl<T, const M: usize, const N: usize> UnwindSafe for SMatrix<T, M, N>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