Matrix

Struct Matrix 

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

Implementations§

Source§

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

Source

pub const fn new(cols: [Vector<T, M>; N]) -> Self

Source

pub fn gen<F>(f: F) -> Self
where F: Fn(usize, usize) -> T,

Source

pub fn submatrix<const P: usize, const Q: usize>( self, col_offset: usize, row_offset: usize, ) -> Matrix<T, P, Q>
where T: Clone,

Source

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

Source

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

Source

pub fn map_mut<F>(&mut self, f: F)
where F: Fn(&mut T),

Source

pub fn map_column<F>(self, f: F, col_idx: usize) -> Self
where F: Fn(T) -> T, T: Debug,

Source

pub fn map_column_mut<F>(&mut self, f: F, col_idx: usize)
where F: Fn(&mut T), T: Debug,

Source

pub fn apply<F, U, V>(self, f: F, rhs: Matrix<U, M, N>) -> Matrix<V, M, N>
where F: Fn(T, U) -> V,

Source

pub fn apply_mut<F, U>(&mut self, f: F, rhs: Matrix<U, M, N>)
where F: Fn(&mut T, U),

Source

pub fn iter(&self) -> <&Self as IntoIterator>::IntoIter

Source

pub fn into_iter(self) -> <Self as IntoIterator>::IntoIter

Source

pub fn iter_mut(&mut self) -> <&mut Self as IntoIterator>::IntoIter

Source

pub fn row_echelon_form(self) -> Self
where T: Float + Debug,

Source

pub fn reduced_row_echelon_form(self) -> Self
where T: Float + Debug,

Source

pub fn column_echelon_form(self) -> Self
where T: Float + Debug,

Source

pub fn reduced_column_echelon_form(self) -> Self
where T: Float + Debug,

Source

pub fn sort_columns_by_leading_coefficient_index(self) -> Self
where T: Zero + Clone + Debug,

Source

pub fn swap_columns(&mut self, col1_idx: usize, col2_idx: usize)

Source§

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

Source

pub fn new_column(col_data: [T; N]) -> Self

Source§

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

Source

pub fn new_row(row_data: [T; N]) -> Self

Trait Implementations§

Source§

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

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

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

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

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: Div<T, Output = T> + Clone,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: 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: DivAssign<T> + Clone,

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<T, const N: usize> From<Matrix<T, N, 1>> for Vector<T, N>

Source§

fn from(value: Matrix<T, N, 1>) -> Self

Converts to this type from the input type.
Source§

impl<T, const N: usize> From<Vector<T, N>> for Matrix<T, N, 1>

Source§

fn from(value: Vector<T, N>) -> Self

Converts to this type from the input type.
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, const M: usize, const N: usize> Index<usize> for Matrix<T, M, N>

Source§

type Output = Vector<T, M>

The returned type after indexing.
Source§

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

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

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

Source§

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

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

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

Source§

type Item = &'a Vector<T, M>

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Vector<T, 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<'a, T, const M: usize, const N: usize> IntoIterator for &'a mut Matrix<T, M, N>

Source§

type Item = &'a mut Vector<T, M>

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, Vector<T, 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, const M: usize, const N: usize> IntoIterator for Matrix<T, M, N>

Source§

type Item = Vector<T, M>

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<Vector<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, const M: usize, const N: usize, const P: usize> Mul<Matrix<T, N, P>> for Matrix<T, M, N>
where T: Clone + Mul<T, 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: Mul<T, Output = T> + Clone,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

type Output = Vector<T, M>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<T, const M: usize> One for Matrix<T, M, M>
where T: Clone + Mul<T, Output = T> + Sum + One + Zero,

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: 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, const M: usize, const N: usize> Sub for Matrix<T, M, N>
where T: Sub<T, Output = T>,

Source§

type Output = Matrix<T, M, N>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

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

Performs the -= operation. Read more
Source§

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

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: 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V