Struct Matrix

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

A 2D array of values which can be operated upon.

Matrices have a fixed size known at compile time

Implementations§

Source§

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

Operations for column vectors

Source

pub fn dot<R>(&self, rhs: &R) -> T
where for<'s> &'s Self: Mul<&'s R, Output = Self>, T: Sum<T>,

Compute the dot product of two vectors, otherwise known as the scalar product.

This is the sum of the elementwise product, or in math terms

$vec(a) * vec(b) = sum_(i=1)^n a_i b_i = a_1 b_1 + a_2 b_2 + … + a_n b_n$

for example, $[[1],[2],[3]] * [[4],[5],[6]] = (1 * 4) + (2 * 5) + (3 * 6) = 32$

For vectors in euclidean space, this has the property that it is equal to the magnitudes of the vectors times the cosine of the angle between them.

$vec(a) * vec(b) = |vec(a)| |vec(b)| cos(theta)$

this also gives it the special property that the dot product of a vector and itself is the square of its magnitude. You may recognize the 2D version as the pythagorean theorem.

see dot product on Wikipedia for more information.

Source

pub fn sqrmag(&self) -> T
where for<'s> &'s Self: Mul<&'s Self, Output = Self>, T: Sum<T>,

Source

pub fn mag(&self) -> T
where T: Sum<T> + Mul<T> + Real,

Source

pub fn normalized(&self) -> Option<Self>
where T: Sum<T> + Mul<T> + Real,

Source§

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

Cross product operations for column vectors in $RR^3$

Source

pub fn cross_r<R: Copy>(&self, rhs: &Vector<R, 3>) -> Self
where T: NumOps<R> + NumOps,

Source

pub fn cross_l<R>(&self, rhs: &Vector<R, 3>) -> Vector<R, 3>
where R: NumOps<T> + NumOps + Copy,

Source§

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

Operations for Matrices

Source

pub fn mmul<R: Copy, const P: usize>( &self, rhs: &Matrix<R, N, P>, ) -> Matrix<T, M, P>
where T: Default + NumOps<R> + Sum,

Source

pub fn abs(&self) -> Self
where T: Signed + Default,

Computes the absolute value of each element of the matrix

Source

pub fn signum(&self) -> Self
where T: Signed + Default,

Computes the sign of each element of the matrix

Source

pub fn pow<R, O>(self, rhs: R) -> O
where Self: Pow<R, Output = O>,

Raises every element to the power of rhs, where rhs is either a scalar or a matrix of exponents

Source§

impl<T: Copy + Zero + One, const N: usize> Matrix<T, N, N>

Source

pub fn identity() -> Self

Create an identity matrix, a square matrix where the diagonals are 1 and all other elements are 0.

for example,

$bbI = [[1,0,0],[0,1,0],[0,0,1]]$

Matrix multiplication between a matrix and the identity matrix always results in itself

$bbA xx bbI = bbA$

§Examples
let i = Matrix::<i32,3,3>::identity();
assert_eq!(i, Matrix::mat([[1, 0, 0],
                           [0, 1, 0],
                           [0, 0, 1]]))

Note that the identity only exists for matrices that are square, so this doesnt work:

let i = Matrix::<i32,4,2>::identity();
Source§

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

Source

pub fn mat(data: [[T; N]; M]) -> Self

Generate a new matrix from a 2D Array

§Arguments
  • data: A 2D array of elements to copy into the new matrix
§Examples
let a = Matrix::mat([[1,2,3,4];4]);
Source

pub fn fill(scalar: T) -> Matrix<T, M, N>

Generate a new matrix from a single scalar

§Arguments
  • scalar: Scalar value to copy into the new matrix.
§Examples
// these are equivalent
assert_eq!(Matrix::<i32,4,4>::fill(5), Matrix::mat([[5;4];4]))
Source

pub fn from_rows<I>(iter: I) -> Self
where I: IntoIterator<Item = Vector<T, N>>, Self: Default,

Create a matrix from an iterator of vectors

§Arguments
  • iter: iterator of vectors to copy into rows
§Examples

The following is another way of performing Matrix::transpose()

let my_matrix = Matrix::mat([[1, 2, 3],
                             [4, 5, 6]]);

let transpose : Matrix<_,3,2>= Matrix::from_rows(my_matrix.cols());

assert_eq!(transpose, Matrix::mat([[1, 4],
                                   [2, 5],
                                   [3, 6]]))
Source

pub fn from_cols<I>(iter: I) -> Self
where I: IntoIterator<Item = Vector<T, M>>, Self: Default,

Create a matrix from an iterator of vectors

§Arguments
  • iter: iterator of vectors to copy into columns
§Examples

The following is another way of performing Matrix::transpose()

let my_matrix = Matrix::mat([[1, 2, 3],
                             [4, 5, 6]]);

let transpose : Matrix<_,3,2>= Matrix::from_cols(my_matrix.rows());

assert_eq!(transpose, Matrix::mat([[1, 4],
                                   [2, 5],
                                   [3, 6]]))
Source§

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

Source

pub fn vec(data: [T; N]) -> Self

Create a vector from a 1D array. Note that vectors are always column vectors unless explicitly instantiated as row vectors

§Examples
// these are equivalent
assert_eq!(Vector::vec([1,2,3,4]), Matrix::mat([[1],[2],[3],[4]]));
Source§

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

Source

pub fn elements<'s>(&'s self) -> impl Iterator<Item = &'s T> + 's

Returns an iterator over the elements of the matrix in row-major order.

This is identical to the behavior of IntoIterator

§Examples
let my_matrix = Matrix::mat([[1, 2],
                             [3, 4]]);

itertools::assert_equal(my_matrix.elements(), [1,2,3,4].iter())
Source

pub fn elements_mut<'s>(&'s mut self) -> impl Iterator<Item = &'s mut T> + 's

Returns a mutable iterator over the elements of the matrix in row-major order.

§Examples
let mut my_matrix = Matrix::mat([[1, 2],
                                 [3, 4]]);

for elem in my_matrix.elements_mut() {*elem += 2;}
itertools::assert_equal(my_matrix.elements(), [3,4,5,6].iter())
Source

pub fn diagonals<'s>(&'s self) -> impl Iterator<Item = &'s T> + 's

returns an iterator over the elements along the diagonal of a matrix

§Examples
let my_matrix = Matrix::mat([[1, 2, 3],
                             [4, 5, 6],
                             [7, 8, 9],
                             [10,11,12]]);

itertools::assert_equal(my_matrix.diagonals(), [1,5,9].iter())
Source

pub fn subdiagonals<'s>(&'s self) -> impl Iterator<Item = &'s T> + 's

Returns an iterator over the elements directly below the diagonal of a matrix

§Examples
let my_matrix = Matrix::mat([[1, 2, 3],
                             [4, 5, 6],
                             [7, 8, 9],
                             [10,11,12]]);

itertools::assert_equal(my_matrix.subdiagonals(), [4,8,12].iter());
Source

pub fn get(&self, index: impl MatrixIndex) -> Option<&T>

Returns a reference to the element at that position in the matrix, or None if out of bounds.

Index behaves similarly, but will panic if the index is out of bounds instead of returning an option

§Arguments
  • index: a 1D or 2D index into the matrix. See MatrixIndex for more information on matrix indexing.
§Examples
let my_matrix = Matrix::mat([[1, 2],
                             [3, 4]]);

// element at index 2 is the same as the element at row 1, column 0.
assert_eq!(my_matrix.get(2), my_matrix.get((1,0)));

// my_matrix.get() is equivalent to my_matrix[],
// but returns an Option instead of panicking
assert_eq!(my_matrix.get(2), Some(&my_matrix[2]));

// index 4 is out of range, so get(4) returns None.
assert_eq!(my_matrix.get(4), None);
Source

pub fn get_mut(&mut self, index: impl MatrixIndex) -> Option<&mut T>

Returns a mutable reference to the element at that position in the matrix, or None if out of bounds.

IndexMut behaves similarly, but will panic if the index is out of bounds instead of returning an option

§Arguments
  • index: a 1D or 2D index into the matrix. See MatrixIndex for more information on matrix indexing.
§Examples
let mut my_matrix = Matrix::mat([[1, 2],
                                 [3, 4]]);

match my_matrix.get_mut(2) {
    Some(t) => *t = 5,
    None => panic!()};
assert_eq!(my_matrix, Matrix::mat([[1,2],[5,4]]))
Source

pub fn row(&self, m: usize) -> Vector<T, N>

Returns a row of the matrix.

§Panics

Panics if row index m is out of bounds.

§Examples
let my_matrix = Matrix::mat([[1, 2],
                             [3, 4]]);

// row at index 1
assert_eq!(my_matrix.row(1), Vector::vec([3,4]));
Source

pub fn set_row(&mut self, m: usize, val: &Vector<T, N>)

Sets a row of the matrix.

§Panics

Panics if row index m is out of bounds.

§Examples
let mut my_matrix = Matrix::mat([[1, 2],
                                 [3, 4]]);
// row at index 1
my_matrix.set_row(1, &Vector::vec([5,6]));
assert_eq!(my_matrix, Matrix::mat([[1,2],[5,6]]));
Source

pub fn col(&self, n: usize) -> Vector<T, M>

Returns a column of the matrix.

§Panics

Panics if column index n is out of bounds.

§Examples
let my_matrix = Matrix::mat([[1, 2],
                             [3, 4]]);

// column at index 1
assert_eq!(my_matrix.col(1), Vector::vec([2,4]));
Source

pub fn set_col(&mut self, n: usize, val: &Vector<T, M>)

Sets a column of the matrix.

§Panics

Panics if column index n is out of bounds.

§Examples
let mut my_matrix = Matrix::mat([[1, 2],
                                 [3, 4]]);
// column at index 1
my_matrix.set_col(1, &Vector::vec([5,6]));
assert_eq!(my_matrix, Matrix::mat([[1,5],[3,6]]));
Source

pub fn rows<'a>(&'a self) -> impl Iterator<Item = Vector<T, N>> + 'a

Returns an iterator over the rows of the matrix, returning them as column vectors.

Source

pub fn cols<'a>(&'a self) -> impl Iterator<Item = Vector<T, M>> + 'a

Returns an iterator over the columns of the matrix, returning them as column vectors.

Source

pub fn pivot_row(&mut self, m1: usize, m2: usize)

Interchange two rows

§Panics

Panics if row index m1 or m2 are out of bounds

Source

pub fn pivot_col(&mut self, n1: usize, n2: usize)

Interchange two columns

§Panics

Panics if column index n1 or n2 are out of bounds

Source

pub fn permute_rows<const P: usize>( &self, ms: &Vector<usize, P>, ) -> Matrix<T, P, N>
where T: Default,

Apply a permutation matrix to the rows of a matrix

§Arguments
  • ms: a Vector of usize of length P. Each entry is the index of the row that will appear in the result

Returns: a P×N matrix

§Panics

Panics if any of the row indices in ms is out of bounds

§Examples
let my_matrix = Matrix::mat([[1, 2, 3],
                             [4, 5, 6],
                             [7, 8, 9]]);

let permuted = my_matrix.permute_rows(&Vector::vec([1, 0, 2]));
assert_eq!(permuted, Matrix::mat([[4, 5, 6],
                                  [1, 2, 3],
                                  [7, 8, 9]]))
Source

pub fn permute_cols<const P: usize>( &self, ns: &Vector<usize, P>, ) -> Matrix<T, M, P>
where T: Default,

Apply a permutation matrix to the columns of a matrix

§Arguments
  • ns: a Vector of usize of length P. Each entry is the index of the column that will appear in the result

Returns: a P×N matrix

§Panics

Panics if any of the column indices in ns is out of bounds

Source

pub fn transpose(&self) -> Matrix<T, N, M>
where Matrix<T, N, M>: Default,

Returns the transpose $M^T$ of the matrix, or the matrix flipped across its diagonal.

§Examples
let my_matrix = Matrix::mat([[1, 2, 3],
                             [4, 5, 6]]);

assert_eq!(
    my_matrix.transpose(),
    Matrix::mat([[1, 4],
                 [2, 5],
                 [3, 6]]))

Trait Implementations§

Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

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

Performs the += operation. Read more
Source§

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

Source§

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

Performs the += operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> AddAssign<R> for Matrix<L, M, N>
where L: AddAssign<R> + Copy, R: Copy + Num,

Source§

fn add_assign(&mut self, r: R)

Performs the += operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: Matrix<R, M, N>) -> Self::Output

Performs the & operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the & operator.
Source§

fn bitand(self, other: Matrix<R, M, N>) -> Self::Output

Performs the & operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

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

Source§

fn bitand_assign(&mut self, other: &Matrix<R, M, N>)

Performs the &= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> BitAndAssign<Matrix<R, M, N>> for Matrix<L, M, N>
where L: BitAndAssign<R> + Copy, R: Copy,

Source§

fn bitand_assign(&mut self, other: Matrix<R, M, N>)

Performs the &= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> BitAndAssign<R> for Matrix<L, M, N>
where L: BitAndAssign<R> + Copy, R: Copy + Num,

Source§

fn bitand_assign(&mut self, r: R)

Performs the &= operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Matrix<R, M, N>) -> Self::Output

Performs the | operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Matrix<R, M, N>) -> Self::Output

Performs the | operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

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

Source§

fn bitor_assign(&mut self, other: &Matrix<R, M, N>)

Performs the |= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> BitOrAssign<Matrix<R, M, N>> for Matrix<L, M, N>
where L: BitOrAssign<R> + Copy, R: Copy,

Source§

fn bitor_assign(&mut self, other: Matrix<R, M, N>)

Performs the |= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> BitOrAssign<R> for Matrix<L, M, N>
where L: BitOrAssign<R> + Copy, R: Copy + Num,

Source§

fn bitor_assign(&mut self, r: R)

Performs the |= operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: Matrix<R, M, N>) -> Self::Output

Performs the ^ operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, other: Matrix<R, M, N>) -> Self::Output

Performs the ^ operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the ^ operator.
Source§

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

Performs the ^ operation. Read more
Source§

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

Source§

fn bitxor_assign(&mut self, other: &Matrix<R, M, N>)

Performs the ^= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> BitXorAssign<Matrix<R, M, N>> for Matrix<L, M, N>
where L: BitXorAssign<R> + Copy, R: Copy,

Source§

fn bitxor_assign(&mut self, other: Matrix<R, M, N>)

Performs the ^= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> BitXorAssign<R> for Matrix<L, M, N>
where L: BitXorAssign<R> + Copy, R: Copy + Num,

Source§

fn bitxor_assign(&mut self, r: R)

Performs the ^= operation. Read more
Source§

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

Source§

fn min_value() -> Self

Returns the smallest finite number this type can represent
Source§

fn max_value() -> Self

Returns the largest finite number this type can represent
Source§

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

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, const M: usize, const N: usize> Debug for Matrix<T, M, N>
where T: Copy + Debug,

Source§

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

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

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

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the / operator.
Source§

fn div(self, other: Matrix<R, M, N>) -> Self::Output

Performs the / operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the / operator.
Source§

fn div(self, other: Matrix<R, M, N>) -> Self::Output

Performs the / operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

fn div_assign(&mut self, other: &Matrix<R, M, N>)

Performs the /= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> DivAssign<Matrix<R, M, N>> for Matrix<L, M, N>
where L: DivAssign<R> + Copy, R: Copy,

Source§

fn div_assign(&mut self, other: Matrix<R, M, N>)

Performs the /= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> DivAssign<R> for Matrix<L, M, N>
where L: DivAssign<R> + Copy, R: Copy + Num,

Source§

fn div_assign(&mut self, r: R)

Performs the /= operation. Read more
Source§

impl<T: Copy, const M: usize, const N: usize> From<[[T; N]; M]> for Matrix<T, M, N>

Source§

fn from(data: [[T; N]; M]) -> Self

Converts to this type from the input type.
Source§

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

Source§

fn from(scalar: T) -> Self

Converts to this type from the input type.
Source§

impl<T: Copy, const M: usize, const N: usize> FromIterator<T> for Matrix<T, M, N>
where Self: Default,

Source§

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

Creates a value from an iterator. Read more
Source§

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

Source§

type Output = T

The returned type after indexing.
Source§

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

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

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

Source§

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

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

impl<T: Copy + Debug, const M: usize, const N: usize> Into<[[T; N]; M]> for Matrix<T, M, N>

Source§

fn into(self) -> [[T; N]; M]

Converts this type into the (usually inferred) input type.
Source§

impl<T: Copy, 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 = Flatten<IntoIter<[T; N], M>>

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: Copy + Inv<Output = T> + Default, const M: usize, const N: usize> Inv for Matrix<T, M, N>

Inverse trait. Note that this is the elementwise inverse, not the matrix inverse. For the inverse matrix see LUDecomposable::inv()

Source§

type Output = Matrix<T, M, N>

The result after applying the operator.
Source§

fn inv(self) -> Self::Output

Returns the multiplicative inverse of self. Read more
Source§

impl<T, const N: usize> LUDecompose<T, N> for Matrix<T, N, N>
where T: Copy + Default + Real + Sum + Product + Signed,

Source§

fn lu(&self) -> Option<LUDecomposition<T, N>>

return this matrix’s LUDecomposition, or None if the matrix is singular. This can be used to solve for multiple results Read more
Source§

fn inv(&self) -> Option<Matrix<T, N, N>>

Calculate the inverse of the matrix, such that $bbMxxbbM^{-1} = bbI$, or None if the matrix is singular. Read more
Source§

fn det(&self) -> T

Calculate the determinant $|M|$ of the matrix $M$. If the matrix is singular, the determinant is 0
Source§

fn solve<const M: usize>(&self, b: &Matrix<T, N, M>) -> Option<Matrix<T, N, M>>

Solve for $x$ in $bbM xx x = b$ Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Matrix<R, M, N>) -> Self::Output

Performs the * operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Matrix<R, M, N>) -> Self::Output

Performs the * operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

fn mul_assign(&mut self, other: &Matrix<R, M, N>)

Performs the *= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> MulAssign<Matrix<R, M, N>> for Matrix<L, M, N>
where L: MulAssign<R> + Copy, R: Copy,

Source§

fn mul_assign(&mut self, other: Matrix<R, M, N>)

Performs the *= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> MulAssign<R> for Matrix<L, M, N>
where L: MulAssign<R> + Copy, R: Copy + Num,

Source§

fn mul_assign(&mut self, r: R)

Performs the *= operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

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

Source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
Source§

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

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, R, O, const M: usize, const N: usize> Pow<Matrix<R, M, N>> for Matrix<T, M, N>
where T: Copy + Pow<R, Output = O>, R: Copy, O: Copy + Default,

Pow for $Matrix^{Matrix}$

Source§

type Output = Matrix<O, M, N>

The result after applying the operator.
Source§

fn pow(self, rhs: Matrix<R, M, N>) -> Self::Output

Returns self to the power rhs. Read more
Source§

impl<T, R, O, const M: usize, const N: usize> Pow<R> for Matrix<T, M, N>
where T: Copy + Pow<R, Output = O>, R: Copy + Num, O: Copy + Default,

Pow for $Matrix^{scalar}$

Source§

type Output = Matrix<O, M, N>

The result after applying the operator.
Source§

fn pow(self, rhs: R) -> Self::Output

Returns self to the power rhs. Read more
Source§

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

Source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the % operator.
Source§

fn rem(self, other: Matrix<R, M, N>) -> Self::Output

Performs the % operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the % operator.
Source§

fn rem(self, other: Matrix<R, M, N>) -> Self::Output

Performs the % operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

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

Source§

fn rem_assign(&mut self, other: &Matrix<R, M, N>)

Performs the %= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> RemAssign<Matrix<R, M, N>> for Matrix<L, M, N>
where L: RemAssign<R> + Copy, R: Copy,

Source§

fn rem_assign(&mut self, other: Matrix<R, M, N>)

Performs the %= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> RemAssign<R> for Matrix<L, M, N>
where L: RemAssign<R> + Copy, R: Copy + Num,

Source§

fn rem_assign(&mut self, r: R)

Performs the %= operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

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

Performs the << operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

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

Performs the << operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

fn shl(self, other: Matrix<R, M, N>) -> Self::Output

Performs the << operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

fn shl(self, other: Matrix<R, M, N>) -> Self::Output

Performs the << operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

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

Performs the << operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

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

Performs the << operation. Read more
Source§

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

Source§

fn shl_assign(&mut self, other: &Matrix<R, M, N>)

Performs the <<= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> ShlAssign<Matrix<R, M, N>> for Matrix<L, M, N>
where L: ShlAssign<R> + Copy, R: Copy,

Source§

fn shl_assign(&mut self, other: Matrix<R, M, N>)

Performs the <<= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> ShlAssign<R> for Matrix<L, M, N>
where L: ShlAssign<R> + Copy, R: Copy + Num,

Source§

fn shl_assign(&mut self, r: R)

Performs the <<= operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

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

Performs the >> operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

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

Performs the >> operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

fn shr(self, other: Matrix<R, M, N>) -> Self::Output

Performs the >> operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

fn shr(self, other: Matrix<R, M, N>) -> Self::Output

Performs the >> operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

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

Performs the >> operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

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

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

Performs the >> operation. Read more
Source§

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

Source§

fn shr_assign(&mut self, other: &Matrix<R, M, N>)

Performs the >>= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> ShrAssign<Matrix<R, M, N>> for Matrix<L, M, N>
where L: ShrAssign<R> + Copy, R: Copy,

Source§

fn shr_assign(&mut self, other: Matrix<R, M, N>)

Performs the >>= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> ShrAssign<R> for Matrix<L, M, N>
where L: ShrAssign<R> + Copy, R: Copy + Num,

Source§

fn shr_assign(&mut self, r: R)

Performs the >>= operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = Matrix<L, M, N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

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

Performs the -= operation. Read more
Source§

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

Source§

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

Performs the -= operation. Read more
Source§

impl<L, R, const M: usize, const N: usize> SubAssign<R> for Matrix<L, M, N>
where L: SubAssign<R> + Copy, R: Copy + Num,

Source§

fn sub_assign(&mut self, r: R)

Performs the -= operation. Read more
Source§

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

Source§

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

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

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

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

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

Source§

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

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<!> for T

Source§

fn from(t: !) -> T

Converts to this type from the input type.
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> LowerBounded for T
where T: Bounded,

Source§

fn min_value() -> T

Returns the smallest finite number this type can represent
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, 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.
Source§

impl<T> UpperBounded for T
where T: Bounded,

Source§

fn max_value() -> T

Returns the largest finite number this type can represent
Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,