Matrix

Struct Matrix 

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

Implementations§

Source§

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

Source

pub const ZEROS: Self

Source

pub const fn new(data: [[Complex64; N]; M]) -> Self

Source

pub fn from_column_vectors(columns: [Vector<M>; N]) -> Self

Source

pub fn to_column_vectors(self) -> [Vector<M>; N]

Source

pub fn iter(&self) -> impl Iterator<Item = &Complex64>

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut Complex64>

Source

pub fn epsilon(&self) -> f64

Source

pub fn swap_row(&mut self, i: usize, j: usize)

Source

pub fn multiply_row_by_scalar(&mut self, i: usize, scalar: Complex64)

Source

pub fn add_row_with_scalar(&mut self, i: usize, j: usize, scalar: Complex64)

Source

pub fn transpose(&self) -> Matrix<N, M>

Source

pub fn gaussian_elimination(self) -> (Matrix<M, N>, Matrix<M, M>, usize)

Source

pub fn rank(&self) -> usize

Source§

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

Source

pub fn diagonal(data: [Complex64; M]) -> Self

Source

pub fn identity() -> Self

Source

pub fn determinant(&self) -> Complex64

Source

pub fn gauss_jordan_elimination(self) -> (Matrix<M, M>, Matrix<M, M>)

Source

pub fn inverse(self) -> Option<Matrix<M, M>>

Source

pub fn qr_decomposition(self) -> (Matrix<M, M>, Matrix<M, M>)

Source

pub fn schur_form(self, iterations: usize) -> Matrix<M, M>

Source

pub fn eigenvalues(&self, iterations: usize) -> [Complex64; M]

Source

pub fn eigenvectors(&self, iterations: usize) -> [Vector<M>; M]

Source§

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

Source

pub fn dot(&self, rhs: &Vector<N>) -> Complex64

Source

pub fn norm(&self, p: u32) -> f64

Source

pub fn normalize(self) -> Self

Source

pub fn project(self, rhs: Self) -> Self

Source

pub fn gram_schimidt_process<const M: usize>( vectors: [Vector<N>; M], ) -> [Vector<N>; M]

Trait Implementations§

Source§

impl<const M: usize, const N: usize> Add for Matrix<M, N>

Source§

type Output = Matrix<M, N>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

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

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

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

Source§

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

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const M: usize, const N: usize> Debug for Matrix<M, N>

Source§

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

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

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

Source§

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

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

impl<const M: usize, const N: usize> Index<[usize; 2]> for Matrix<M, N>

Source§

type Output = Complex<f64>

The returned type after indexing.
Source§

fn index(&self, [i, j]: [usize; 2]) -> &Self::Output

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

impl<const M: usize, const N: usize> IndexMut<[usize; 2]> for Matrix<M, N>

Source§

fn index_mut(&mut self, index: [usize; 2]) -> &mut Self::Output

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

impl<const M: usize, const N: usize> Mul<Complex<f64>> for Matrix<M, N>

Source§

type Output = Matrix<M, N>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<const M: usize, const N: usize> Mul<Matrix<M, N>> for Complex64

Source§

type Output = Matrix<M, N>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<const M: usize, const N: usize, const P: usize> Mul<Matrix<N, P>> for Matrix<M, N>

Source§

type Output = Matrix<M, P>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<const M: usize, const N: usize> MulAssign<Complex<f64>> for Matrix<M, N>

Source§

fn mul_assign(&mut self, rhs: Complex64)

Performs the *= operation. Read more
Source§

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

Source§

fn eq(&self, other: &Self) -> bool

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

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

Source§

type Output = Matrix<M, N>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

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

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<const M: usize, const N: usize> Sum for Matrix<M, N>

Source§

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

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.