Struct Matrix

Source
pub struct Matrix<T, const M: usize, const N: usize> { /* private fields */ }
Expand description

Represents a matrix with constant M rows and constant N columns.

The underlying data is represented as an array and is always stored in column-major order.

See the crate root for usage examples.

Implementations§

Source§

impl<T> Matrix<T, 1, 1>

Source

pub const fn new(x: T) -> Self

Creates a new vector from the given components.

Source§

impl<T> Matrix<T, 1, 2>

Source

pub const fn new(x: T, y: T) -> Self

Creates a new vector from the given components.

Source§

impl<T> Matrix<T, 1, 3>

Source

pub const fn new(x: T, y: T, z: T) -> Self

Creates a new vector from the given components.

Source§

impl<T> Matrix<T, 1, 4>

Source

pub const fn new(x: T, y: T, z: T, w: T) -> Self

Creates a new vector from the given components.

Source§

impl<T> Matrix<T, 1, 5>

Source

pub const fn new(x: T, y: T, z: T, w: T, a: T) -> Self

Creates a new vector from the given components.

Source§

impl<T> Matrix<T, 1, 6>

Source

pub const fn new(x: T, y: T, z: T, w: T, a: T, b: T) -> Self

Creates a new vector from the given components.

Source§

impl<T> Matrix<T, 2, 1>

Source

pub const fn new(x: T, y: T) -> Self

Creates a new vector from the given components.

Source§

impl<T> Matrix<T, 3, 1>

Source

pub const fn new(x: T, y: T, z: T) -> Self

Creates a new vector from the given components.

Source§

impl<T> Matrix<T, 4, 1>

Source

pub const fn new(x: T, y: T, z: T, w: T) -> Self

Creates a new vector from the given components.

Source§

impl<T> Matrix<T, 5, 1>

Source

pub const fn new(x: T, y: T, z: T, w: T, a: T) -> Self

Creates a new vector from the given components.

Source§

impl<T> Matrix<T, 6, 1>

Source

pub const fn new(x: T, y: T, z: T, w: T, a: T, b: T) -> Self

Creates a new vector from the given components.

Source§

impl<T, const M: usize, const N: usize> Matrix<T, M, N>

Source

pub fn zero() -> Self
where T: Copy + Zero,

Returns a zero matrix.

Source

pub fn repeat(element: T) -> Self
where T: Copy,

Create a new matrix filled with the given element.

Source

pub fn repeat_with<F>(f: F) -> Self
where F: FnMut() -> T,

Create a new matrix filled with computed elements.

Elements will be filled in column-major order.

Source

pub fn as_slice(&self) -> &[T]

Views the underlying data as a contiguous slice.

Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Views the underlying data as a contiguous mutable slice.

Source

pub fn get<I>(&self, i: I) -> Option<&I::Output>
where I: MatrixIndex<Self>,

Returns a reference to an element in the matrix or None if out of bounds.

Source

pub fn get_mut<I>(&mut self, i: I) -> Option<&mut I::Output>
where I: MatrixIndex<Self>,

Returns a mutable reference to an element in the matrix or None if out of bounds.

Source

pub unsafe fn get_unchecked<I>(&self, i: I) -> &I::Output
where I: MatrixIndex<Self>,

Returns a reference to an element in the matrix without doing any bounds checking.

§Safety

Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.

Source

pub unsafe fn get_unchecked_mut<I>(&mut self, i: I) -> &mut I::Output
where I: MatrixIndex<Self>,

Returns a mutable reference to an element in the matrix without doing any bounds checking.

§Safety

Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.

Source

pub fn row(&self, i: usize) -> &Row<T, M, N>

Returns a reference to the i-th row of this matrix.

Source

pub fn row_mut(&mut self, i: usize) -> &mut Row<T, M, N>

Returns a mutable reference to the i-th row of this matrix.

Source

pub fn column(&self, i: usize) -> &Column<T, M, N>

Returns a reference to the i-th column of this matrix.

Source

pub fn column_mut(&mut self, i: usize) -> &mut Column<T, M, N>

Returns a mutable reference to the i-th column of this matrix.

Source

pub fn iter(&self) -> Iter<'_, T>

Returns an iterator over the underlying data.

Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Returns a mutable iterator over the underlying data.

Source

pub fn iter_rows(&self) -> IterRows<'_, T, M, N>

Returns an iterator over the rows in this matrix.

Source

pub fn iter_rows_mut(&mut self) -> IterRowsMut<'_, T, M, N>

Returns a mutable iterator over the rows in this matrix.

Source

pub fn iter_columns(&self) -> IterColumns<'_, T, M, N>

Returns an iterator over the columns in this matrix.

Source

pub fn iter_columns_mut(&mut self) -> IterColumnsMut<'_, T, M, N>

Returns a mutable iterator over the columns in this matrix.

Source

pub fn map<F, U>(self, f: F) -> Matrix<U, M, N>
where F: FnMut(T) -> U,

Returns a matrix of the same size as self, with function f applied to each element in column-major order.

Source

pub fn l1_norm(&self) -> T
where T: Copy + Ord + Abs + Zero + Sum<T>,

Returns the L1 norm of the matrix.

Also known as Manhattan Distance or Taxicab norm. L1 Norm is the sum of the magnitudes of the vectors in a space.

§Note

If the matrix is a row vector this method might not do what you what you expect. For example:

let row_vector = matrix![1, 2, 3];
assert_eq!(row_vector.l1_norm(), 3);

let column_vector = matrix![1; 2; 3];
assert_eq!(column_vector.l1_norm(), 6);
Source§

impl<T, const N: usize> Matrix<T, N, N>

Source

pub fn identity() -> Self
where T: Copy + One + Zero,

Returns an identity matrix.

Source

pub fn diagonal(&self) -> Vector<T, N>
where T: Copy + Zero,

Returns the diagonal of the matrix.

Trait Implementations§

Source§

impl<T, const M: usize, const N: usize> Add<&Matrix<T, M, N>> for &Matrix<T, M, N>
where T: Copy + Zero + Add<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the + operator.
Source§

fn add(self, other: &Matrix<T, M, N>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T, const M: usize, const N: usize> Add<&Matrix<T, M, N>> for Matrix<T, M, N>
where T: Copy + Add<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the + operator.
Source§

fn add(self, other: &Matrix<T, M, N>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T, const M: usize, const N: usize> Add<&T> for &Matrix<T, M, N>
where T: Copy + Zero + Add<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the + operator.
Source§

fn add(self, other: &T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T, const M: usize, const N: usize> Add<&T> for Matrix<T, M, N>
where T: Copy + Add<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the + operator.
Source§

fn add(self, other: &T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T, const M: usize, const N: usize> Add<Matrix<T, M, N>> for &Matrix<T, M, N>
where T: Copy + Zero + Add<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the + operator.
Source§

fn add(self, other: Matrix<T, M, N>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T, const M: usize, const N: usize> Add<T> for &Matrix<T, M, N>
where T: Copy + Zero + Add<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the + operator.
Source§

fn add(self, other: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T, const M: usize, const N: usize> Add<T> for Matrix<T, M, N>
where T: Copy + Add<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the + operator.
Source§

fn add(self, other: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T, const M: usize, const N: usize> Add for Matrix<T, M, N>
where T: Copy + Add<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the + operator.
Source§

fn add(self, other: Matrix<T, M, N>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T, const M: usize, const N: usize> AddAssign<&Matrix<T, M, N>> for Matrix<T, M, N>
where T: Copy + AddAssign,

Source§

fn add_assign(&mut self, other: &Matrix<T, M, N>)

Performs the += operation. Read more
Source§

impl<T, const M: usize, const N: usize> AddAssign<&T> for Matrix<T, M, N>
where T: Copy + AddAssign<T>,

Source§

fn add_assign(&mut self, other: &T)

Performs the += operation. Read more
Source§

impl<'a, T, const M: usize, const N: usize> AddAssign<T> for Matrix<T, M, N>
where T: Copy + AddAssign<T>,

Source§

fn add_assign(&mut self, other: T)

Performs the += operation. Read more
Source§

impl<T, const M: usize, const N: usize> AddAssign for Matrix<T, M, N>
where T: Copy + AddAssign,

Source§

fn add_assign(&mut self, other: Matrix<T, M, N>)

Performs the += operation. Read more
Source§

impl<T: Binary, const M: usize, const N: usize> Binary for Matrix<T, M, N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T, const M: usize, const N: usize> BitAnd<&T> for &Matrix<T, M, N>
where T: Copy + Zero + BitAnd<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: &T) -> Self::Output

Performs the & operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitAnd<&T> for Matrix<T, M, N>
where T: Copy + BitAnd<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: &T) -> Self::Output

Performs the & operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitAnd<T> for &Matrix<T, M, N>
where T: Copy + Zero + BitAnd<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: T) -> Self::Output

Performs the & operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitAnd<T> for Matrix<T, M, N>
where T: Copy + BitAnd<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: T) -> Self::Output

Performs the & operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitAndAssign<&T> for Matrix<T, M, N>
where T: Copy + BitAndAssign<T>,

Source§

fn bitand_assign(&mut self, other: &T)

Performs the &= operation. Read more
Source§

impl<'a, T, const M: usize, const N: usize> BitAndAssign<T> for Matrix<T, M, N>
where T: Copy + BitAndAssign<T>,

Source§

fn bitand_assign(&mut self, other: T)

Performs the &= operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitOr<&T> for &Matrix<T, M, N>
where T: Copy + Zero + BitOr<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: &T) -> Self::Output

Performs the | operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitOr<&T> for Matrix<T, M, N>
where T: Copy + BitOr<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: &T) -> Self::Output

Performs the | operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitOr<T> for &Matrix<T, M, N>
where T: Copy + Zero + BitOr<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: T) -> Self::Output

Performs the | operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitOr<T> for Matrix<T, M, N>
where T: Copy + BitOr<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: T) -> Self::Output

Performs the | operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitOrAssign<&T> for Matrix<T, M, N>
where T: Copy + BitOrAssign<T>,

Source§

fn bitor_assign(&mut self, other: &T)

Performs the |= operation. Read more
Source§

impl<'a, T, const M: usize, const N: usize> BitOrAssign<T> for Matrix<T, M, N>
where T: Copy + BitOrAssign<T>,

Source§

fn bitor_assign(&mut self, other: T)

Performs the |= operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitXor<&T> for &Matrix<T, M, N>
where T: Copy + Zero + BitXor<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: &T) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitXor<&T> for Matrix<T, M, N>
where T: Copy + BitXor<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: &T) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitXor<T> for &Matrix<T, M, N>
where T: Copy + Zero + BitXor<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: T) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitXor<T> for Matrix<T, M, N>
where T: Copy + BitXor<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: T) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<T, const M: usize, const N: usize> BitXorAssign<&T> for Matrix<T, M, N>
where T: Copy + BitXorAssign<T>,

Source§

fn bitxor_assign(&mut self, other: &T)

Performs the ^= operation. Read more
Source§

impl<'a, T, const M: usize, const N: usize> BitXorAssign<T> for Matrix<T, M, N>
where T: Copy + BitXorAssign<T>,

Source§

fn bitxor_assign(&mut self, other: T)

Performs the ^= operation. Read more
Source§

impl<T: Clone, const M: usize, const N: usize> Clone for Matrix<T, M, N>

Source§

fn clone(&self) -> Matrix<T, M, N>

Returns a duplicate 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<T: Debug, const M: usize, const N: usize> Debug for Matrix<T, M, N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: Default, const M: usize, const N: usize> Default for Matrix<T, M, N>

Source§

fn default() -> Self

Create a new matrix using T::default() as an initializer.

Note: this implementation will not be as efficient for types that are Copy. In most cases it would be better to use one of the following:

Source§

impl<T> Deref for Matrix<T, 1, 1>

Source§

type Target = X<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> Deref for Matrix<T, 1, 2>

Source§

type Target = XY<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> Deref for Matrix<T, 1, 3>

Source§

type Target = XYZ<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> Deref for Matrix<T, 1, 4>

Source§

type Target = XYZW<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> Deref for Matrix<T, 1, 5>

Source§

type Target = XYZWA<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> Deref for Matrix<T, 1, 6>

Source§

type Target = XYZWAB<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> Deref for Matrix<T, 2, 1>

Source§

type Target = XY<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> Deref for Matrix<T, 3, 1>

Source§

type Target = XYZ<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> Deref for Matrix<T, 4, 1>

Source§

type Target = XYZW<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> Deref for Matrix<T, 5, 1>

Source§

type Target = XYZWA<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> Deref for Matrix<T, 6, 1>

Source§

type Target = XYZWAB<T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T> DerefMut for Matrix<T, 1, 1>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> DerefMut for Matrix<T, 1, 2>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> DerefMut for Matrix<T, 1, 3>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> DerefMut for Matrix<T, 1, 4>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> DerefMut for Matrix<T, 1, 5>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> DerefMut for Matrix<T, 1, 6>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> DerefMut for Matrix<T, 2, 1>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> DerefMut for Matrix<T, 3, 1>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> DerefMut for Matrix<T, 4, 1>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> DerefMut for Matrix<T, 5, 1>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T> DerefMut for Matrix<T, 6, 1>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T: Display, const M: usize, const N: usize> Display for Matrix<T, M, N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T, const M: usize, const N: usize> Div<&T> for &Matrix<T, M, N>
where T: Copy + Zero + Div<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the / operator.
Source§

fn div(self, other: &T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T, const M: usize, const N: usize> Div<&T> for Matrix<T, M, N>
where T: Copy + Div<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the / operator.
Source§

fn div(self, other: &T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T, const M: usize, const N: usize> Div<T> for &Matrix<T, M, N>
where T: Copy + Zero + Div<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the / operator.
Source§

fn div(self, other: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T, const M: usize, const N: usize> Div<T> for Matrix<T, M, N>
where T: Copy + Div<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the / operator.
Source§

fn div(self, other: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T, const M: usize, const N: usize> DivAssign<&T> for Matrix<T, M, N>
where T: Copy + DivAssign<T>,

Source§

fn div_assign(&mut self, other: &T)

Performs the /= operation. Read more
Source§

impl<'a, T, const M: usize, const N: usize> DivAssign<T> for Matrix<T, M, N>
where T: Copy + DivAssign<T>,

Source§

fn div_assign(&mut self, other: T)

Performs the /= operation. Read more
Source§

impl<T> From<[T; 1]> for Matrix<T, 1, 1>

Source§

fn from(arr: [T; 1]) -> Self

Converts to this type from the input type.
Source§

impl<T> From<(T,)> for Matrix<T, 1, 1>

Source§

fn from((x): (T,)) -> Self

Converts to this type from the input type.
Source§

impl<T, const M: usize, const N: usize> FromIterator<T> for Matrix<T, M, N>

Source§

fn from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = T>,

Create a new matrix from an iterator.

Elements will be filled in column-major order.

§Panics

If the iterator doesn’t yield enough elements to fill the matrix.

Source§

impl<T: Hash, const M: usize, const N: usize> Hash for Matrix<T, M, N>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T, I, const M: usize, const N: usize> Index<I> for Matrix<T, M, N>
where I: MatrixIndex<Self>,

Source§

type Output = <I as MatrixIndex<Matrix<T, M, N>>>::Output

The returned type after indexing.
Source§

fn index(&self, index: I) -> &I::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T, I, const M: usize, const N: usize> IndexMut<I> for Matrix<T, M, N>
where I: MatrixIndex<Self>,

Source§

fn index_mut(&mut self, index: I) -> &mut I::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T, const M: usize, const N: usize> IntoIterator for Matrix<T, M, N>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<T, M, N>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T: LowerExp, const M: usize, const N: usize> LowerExp for Matrix<T, M, N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: LowerHex, const M: usize, const N: usize> LowerHex for Matrix<T, M, N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T, const M: usize, const N: usize> MatrixIndex<Matrix<T, M, N>> for (usize, usize)

Source§

type Output = T

The output type returned by methods.
Source§

fn get(self, matrix: &Matrix<T, M, N>) -> Option<&Self::Output>

Returns a shared reference to the output at this location, if in bounds.
Source§

fn get_mut(self, matrix: &mut Matrix<T, M, N>) -> Option<&mut Self::Output>

Returns a mutable reference to the output at this location, if in bounds.
Source§

unsafe fn get_unchecked( self, matrix: *const Matrix<T, M, N>, ) -> *const Self::Output

Returns a shared reference to the output at this location, without performing any bounds checking. Read more
Source§

unsafe fn get_unchecked_mut( self, matrix: *mut Matrix<T, M, N>, ) -> *mut Self::Output

Returns a mutable reference to the output at this location, without performing any bounds checking. Read more
Source§

fn index(self, matrix: &Matrix<T, M, N>) -> &Self::Output

Returns a shared reference to the output at this location, panicking if out of bounds.
Source§

fn index_mut(self, matrix: &mut Matrix<T, M, N>) -> &mut Self::Output

Returns a mutable reference to the output at this location, panicking if out of bounds.
Source§

impl<T, const M: usize, const N: usize> MatrixIndex<Matrix<T, M, N>> for usize

Source§

type Output = T

The output type returned by methods.
Source§

fn get(self, matrix: &Matrix<T, M, N>) -> Option<&Self::Output>

Returns a shared reference to the output at this location, if in bounds.
Source§

fn get_mut(self, matrix: &mut Matrix<T, M, N>) -> Option<&mut Self::Output>

Returns a mutable reference to the output at this location, if in bounds.
Source§

unsafe fn get_unchecked( self, matrix: *const Matrix<T, M, N>, ) -> *const Self::Output

Returns a shared reference to the output at this location, without performing any bounds checking. Read more
Source§

unsafe fn get_unchecked_mut( self, matrix: *mut Matrix<T, M, N>, ) -> *mut Self::Output

Returns a mutable reference to the output at this location, without performing any bounds checking. Read more
Source§

fn index(self, matrix: &Matrix<T, M, N>) -> &Self::Output

Returns a shared reference to the output at this location, panicking if out of bounds.
Source§

fn index_mut(self, matrix: &mut Matrix<T, M, N>) -> &mut Self::Output

Returns a mutable reference to the output at this location, panicking if out of bounds.
Source§

impl<T, const N: usize, const M: usize, const P: usize> Mul<&Matrix<T, N, P>> for &Matrix<T, M, N>
where T: Copy + Zero + Mul<Output = T> + Sum,

Source§

type Output = Matrix<T, M, P>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Matrix<T, N, P>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, const N: usize, const M: usize, const P: usize> Mul<&Matrix<T, N, P>> for Matrix<T, M, N>
where T: Copy + Zero + Mul<Output = T> + Sum,

Source§

type Output = Matrix<T, M, P>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Matrix<T, N, P>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, const M: usize, const N: usize> Mul<&T> for &Matrix<T, M, N>
where T: Copy + Zero + Mul<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, const M: usize, const N: usize> Mul<&T> for Matrix<T, M, N>
where T: Copy + Mul<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, const N: usize, const M: usize, const P: usize> Mul<Matrix<T, N, P>> for &Matrix<T, M, N>
where T: Copy + Zero + Mul<Output = T> + Sum,

Source§

type Output = Matrix<T, M, P>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Matrix<T, N, P>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, const N: usize, const M: usize, const P: usize> Mul<Matrix<T, N, P>> for Matrix<T, M, N>
where T: Copy + Zero + Mul<Output = T> + Sum,

Source§

type Output = Matrix<T, M, P>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Matrix<T, N, P>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, const M: usize, const N: usize> Mul<T> for &Matrix<T, M, N>
where T: Copy + Zero + Mul<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, const M: usize, const N: usize> Mul<T> for Matrix<T, M, N>
where T: Copy + Mul<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, const M: usize, const N: usize> MulAssign<&T> for Matrix<T, M, N>
where T: Copy + MulAssign<T>,

Source§

fn mul_assign(&mut self, other: &T)

Performs the *= operation. Read more
Source§

impl<'a, T, const M: usize, const N: usize> MulAssign<T> for Matrix<T, M, N>
where T: Copy + MulAssign<T>,

Source§

fn mul_assign(&mut self, other: T)

Performs the *= operation. Read more
Source§

impl<T, const M: usize, const N: usize> Neg for &Matrix<T, M, N>
where T: Copy + Zero + Neg<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T, const M: usize, const N: usize> Neg for Matrix<T, M, N>
where T: Copy + Zero + Neg<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T, const M: usize, const N: usize> Not for &Matrix<T, M, N>
where T: Copy + Zero + Not<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T, const M: usize, const N: usize> Not for Matrix<T, M, N>
where T: Copy + Zero + Not<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<T: Octal, const M: usize, const N: usize> Octal for Matrix<T, M, N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: Ord, const M: usize, const N: usize> Ord for Matrix<T, M, N>

Source§

fn cmp(&self, other: &Matrix<T, M, N>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq, const M: usize, const N: usize> PartialEq for Matrix<T, M, N>

Source§

fn eq(&self, other: &Matrix<T, M, N>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd, const M: usize, const N: usize> PartialOrd for Matrix<T, M, N>

Source§

fn partial_cmp(&self, other: &Matrix<T, M, N>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T, const M: usize, const N: usize> Rem<&T> for &Matrix<T, M, N>
where T: Copy + Zero + Rem<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the % operator.
Source§

fn rem(self, other: &T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T, const M: usize, const N: usize> Rem<&T> for Matrix<T, M, N>
where T: Copy + Rem<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the % operator.
Source§

fn rem(self, other: &T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T, const M: usize, const N: usize> Rem<T> for &Matrix<T, M, N>
where T: Copy + Zero + Rem<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the % operator.
Source§

fn rem(self, other: T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T, const M: usize, const N: usize> Rem<T> for Matrix<T, M, N>
where T: Copy + Rem<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the % operator.
Source§

fn rem(self, other: T) -> Self::Output

Performs the % operation. Read more
Source§

impl<T, const M: usize, const N: usize> RemAssign<&T> for Matrix<T, M, N>
where T: Copy + RemAssign<T>,

Source§

fn rem_assign(&mut self, other: &T)

Performs the %= operation. Read more
Source§

impl<'a, T, const M: usize, const N: usize> RemAssign<T> for Matrix<T, M, N>
where T: Copy + RemAssign<T>,

Source§

fn rem_assign(&mut self, other: T)

Performs the %= operation. Read more
Source§

impl<T, const M: usize, const N: usize> Shl<&T> for &Matrix<T, M, N>
where T: Copy + Zero + Shl<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the << operator.
Source§

fn shl(self, other: &T) -> Self::Output

Performs the << operation. Read more
Source§

impl<T, const M: usize, const N: usize> Shl<&T> for Matrix<T, M, N>
where T: Copy + Shl<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the << operator.
Source§

fn shl(self, other: &T) -> Self::Output

Performs the << operation. Read more
Source§

impl<T, const M: usize, const N: usize> Shl<T> for &Matrix<T, M, N>
where T: Copy + Zero + Shl<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the << operator.
Source§

fn shl(self, other: T) -> Self::Output

Performs the << operation. Read more
Source§

impl<T, const M: usize, const N: usize> Shl<T> for Matrix<T, M, N>
where T: Copy + Shl<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the << operator.
Source§

fn shl(self, other: T) -> Self::Output

Performs the << operation. Read more
Source§

impl<T, const M: usize, const N: usize> ShlAssign<&T> for Matrix<T, M, N>
where T: Copy + ShlAssign<T>,

Source§

fn shl_assign(&mut self, other: &T)

Performs the <<= operation. Read more
Source§

impl<'a, T, const M: usize, const N: usize> ShlAssign<T> for Matrix<T, M, N>
where T: Copy + ShlAssign<T>,

Source§

fn shl_assign(&mut self, other: T)

Performs the <<= operation. Read more
Source§

impl<T, const M: usize, const N: usize> Shr<&T> for &Matrix<T, M, N>
where T: Copy + Zero + Shr<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &T) -> Self::Output

Performs the >> operation. Read more
Source§

impl<T, const M: usize, const N: usize> Shr<&T> for Matrix<T, M, N>
where T: Copy + Shr<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the >> operator.
Source§

fn shr(self, other: &T) -> Self::Output

Performs the >> operation. Read more
Source§

impl<T, const M: usize, const N: usize> Shr<T> for &Matrix<T, M, N>
where T: Copy + Zero + Shr<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the >> operator.
Source§

fn shr(self, other: T) -> Self::Output

Performs the >> operation. Read more
Source§

impl<T, const M: usize, const N: usize> Shr<T> for Matrix<T, M, N>
where T: Copy + Shr<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the >> operator.
Source§

fn shr(self, other: T) -> Self::Output

Performs the >> operation. Read more
Source§

impl<T, const M: usize, const N: usize> ShrAssign<&T> for Matrix<T, M, N>
where T: Copy + ShrAssign<T>,

Source§

fn shr_assign(&mut self, other: &T)

Performs the >>= operation. Read more
Source§

impl<'a, T, const M: usize, const N: usize> ShrAssign<T> for Matrix<T, M, N>
where T: Copy + ShrAssign<T>,

Source§

fn shr_assign(&mut self, other: T)

Performs the >>= operation. Read more
Source§

impl<T, const M: usize, const N: usize> Sub<&Matrix<T, M, N>> for &Matrix<T, M, N>
where T: Copy + Zero + Sub<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &Matrix<T, M, N>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, const M: usize, const N: usize> Sub<&Matrix<T, M, N>> for Matrix<T, M, N>
where T: Copy + Sub<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &Matrix<T, M, N>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, const M: usize, const N: usize> Sub<&T> for &Matrix<T, M, N>
where T: Copy + Zero + Sub<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, const M: usize, const N: usize> Sub<&T> for Matrix<T, M, N>
where T: Copy + Sub<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, const M: usize, const N: usize> Sub<Matrix<T, M, N>> for &Matrix<T, M, N>
where T: Copy + Zero + Sub<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Matrix<T, M, N>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, const M: usize, const N: usize> Sub<T> for &Matrix<T, M, N>
where T: Copy + Zero + Sub<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the - operator.
Source§

fn sub(self, other: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, const M: usize, const N: usize> Sub<T> for Matrix<T, M, N>
where T: Copy + Sub<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the - operator.
Source§

fn sub(self, other: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, const M: usize, const N: usize> Sub for Matrix<T, M, N>
where T: Copy + Sub<Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Matrix<T, M, N>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, const M: usize, const N: usize> SubAssign<&Matrix<T, M, N>> for Matrix<T, M, N>
where T: Copy + SubAssign,

Source§

fn sub_assign(&mut self, other: &Matrix<T, M, N>)

Performs the -= operation. Read more
Source§

impl<T, const M: usize, const N: usize> SubAssign<&T> for Matrix<T, M, N>
where T: Copy + SubAssign<T>,

Source§

fn sub_assign(&mut self, other: &T)

Performs the -= operation. Read more
Source§

impl<'a, T, const M: usize, const N: usize> SubAssign<T> for Matrix<T, M, N>
where T: Copy + SubAssign<T>,

Source§

fn sub_assign(&mut self, other: T)

Performs the -= operation. Read more
Source§

impl<T, const M: usize, const N: usize> SubAssign for Matrix<T, M, N>
where T: Copy + SubAssign,

Source§

fn sub_assign(&mut self, other: Matrix<T, M, N>)

Performs the -= operation. Read more
Source§

impl<T, const M: usize, const N: usize> Sum for Matrix<T, M, N>
where Self: Add<Output = Self>, T: Copy + Zero,

Source§

fn sum<I>(iter: I) -> Self
where I: Iterator<Item = Self>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<T: UpperExp, const M: usize, const N: usize> UpperExp for Matrix<T, M, N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: UpperHex, const M: usize, const N: usize> UpperHex for Matrix<T, M, N>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: Copy, const M: usize, const N: usize> Copy for Matrix<T, M, N>

Source§

impl<T: Eq, const M: usize, const N: usize> Eq for Matrix<T, M, N>

Source§

impl<T, const M: usize, const N: usize> StructuralPartialEq for Matrix<T, M, N>

Auto Trait Implementations§

§

impl<T, const M: usize, const N: usize> Freeze for Matrix<T, M, N>
where T: Freeze,

§

impl<T, const M: usize, const N: usize> RefUnwindSafe for Matrix<T, M, N>
where T: RefUnwindSafe,

§

impl<T, const M: usize, const N: usize> Send for Matrix<T, M, N>
where T: Send,

§

impl<T, const M: usize, const N: usize> Sync for Matrix<T, M, N>
where T: Sync,

§

impl<T, const M: usize, const N: usize> Unpin for Matrix<T, M, N>
where T: Unpin,

§

impl<T, const M: usize, const N: usize> UnwindSafe for Matrix<T, M, N>
where T: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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>,

Source§

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.