Struct static_math::matrix2x2::M22 [−][src]
pub struct M22<T>(_);
A static Matrix of 2x2 shape
Implementations
impl<T> M22<T>[src]
pub const fn new(data_input: [[T; 2]; 2]) -> Self[src]
pub const fn create(a: T, b: T, c: T, d: T) -> Self[src]
pub const fn rows(&self) -> usize[src]
pub const fn cols(&self) -> usize[src]
impl<T: Num + Copy> M22<T>[src]
pub fn identity() -> M22<T>[src]
contruct identity matrix
pub fn zeros() -> M22<T>[src]
construct the matrix with all zeros
pub fn as_vec(&self) -> [T; 4][src]
transform the matrix to a flatten vector
pub fn new_from_vecs(cols: V2<V2<T>>) -> Self[src]
construct the matrix from columns-vectors
pub fn get_diagonal(&self) -> V2<T>[src]
get the diagonal of the matrix
impl<T: Num + Copy> M22<T>[src]
pub fn get_rows(self) -> V2<V2<T>>[src]
get the rows of the matrix as a vectors
pub fn get_cols(self) -> V2<V2<T>>[src]
get the columns of the matrix as a vectors
pub fn for_each(&self, f: impl Fn(T) -> T) -> Self[src]
Applies f of each element in the M22
impl<T: Float + Sum> M22<T>[src]
pub fn real_eigenvals(&self) -> Option<V2<T>>[src]
calculate the real eigen values for the matrix
Methods from Deref<Target = [[T; 2]; 2]>
pub fn as_slice(&self) -> &[T][src]
array_methods)Returns a slice containing the entire array. Equivalent to &s[..].
pub fn as_mut_slice(&mut self) -> &mut [T][src]
array_methods)Returns a mutable slice containing the entire array. Equivalent to
&mut s[..].
pub fn each_ref(&self) -> [&T; N][src]
array_methods)Borrows each element and returns an array of references with the same
size as self.
Example
#![feature(array_methods)] let floats = [3.1, 2.7, -1.0]; let float_refs: [&f64; 3] = floats.each_ref(); assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);
This method is particularly useful if combined with other methods, like
map. This way, you can avoid moving the original
array if its elements are not Copy.
#![feature(array_methods, array_map)] let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()]; let is_ascii = strings.each_ref().map(|s| s.is_ascii()); assert_eq!(is_ascii, [true, false, true]); // We can still access the original array: it has not been moved. assert_eq!(strings.len(), 3);
pub fn each_mut(&mut self) -> [&mut T; N][src]
array_methods)Borrows each element mutably and returns an array of mutable references
with the same size as self.
Example
#![feature(array_methods)] let mut floats = [3.1, 2.7, -1.0]; let float_refs: [&mut f64; 3] = floats.each_mut(); *float_refs[0] = 0.0; assert_eq!(float_refs, [&mut 0.0, &mut 2.7, &mut -1.0]); assert_eq!(floats, [0.0, 2.7, -1.0]);
Trait Implementations
impl<T: Num + Copy> Add<M22<T>> for M22<T>[src]
type Output = Self
The resulting type after applying the + operator.
fn add(self, rhs: Self) -> Self[src]
impl<T: Num + Copy> AddAssign<M22<T>> for M22<T>[src]
fn add_assign(&mut self, other: Self)[src]
impl<T: Clone> Clone for M22<T>[src]
impl<T: Copy> Copy for M22<T>[src]
impl<T: Debug> Debug for M22<T>[src]
impl<T> Deref for M22<T>[src]
type Target = [[T; 2]; 2]
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target[src]
impl<T> DerefMut for M22<T>[src]
impl<T: Num + Display> Display for M22<T>[src]
impl<T> From<[[T; 2]; 2]> for M22<T>[src]
impl<T> Index<(usize, usize)> for M22<T>[src]
impl<T> IndexMut<(usize, usize)> for M22<T>[src]
impl<T: Float + Sum> LinearAlgebra<T> for M22<T>[src]
fn rows(&self) -> usize[src]
fn cols(&self) -> usize[src]
fn det(&self) -> T[src]
fn transpose(&self) -> M22<T>[src]
fn trace(&self) -> T[src]
fn norm2(&self) -> T[src]
fn inverse(&self) -> Option<Self>[src]
fn qr(&self) -> Option<(Self, Self)>[src]
Calculate de QR factorization of the M22 via gram-schmidt orthogonalization process
fn shape(&self) -> (usize, usize)[src]
impl<T: Num + Copy> Mul<M22<T>> for M22<T>[src]
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: Self) -> Self[src]
impl<T: Num + Copy> Mul<M22<T>> for V2<T>[src]
type Output = V2<T>
The resulting type after applying the * operator.
fn mul(self, rhs: M22<T>) -> V2<T>[src]
impl<T: Num + Copy> Mul<T> for M22<T>[src]
type Output = M22<T>
The resulting type after applying the * operator.
fn mul(self, rhs: T) -> M22<T>[src]
impl<T: Num + Copy> Mul<V2<T>> for M22<T>[src]
type Output = V2<T>
The resulting type after applying the * operator.
fn mul(self, rhs: V2<T>) -> V2<T>[src]
impl<T: Num + Copy> One for M22<T>[src]
fn one() -> M22<T>[src]
Create an identity matrix
pub fn set_one(&mut self)[src]
pub fn is_one(&self) -> bool where
Self: PartialEq<Self>, [src]
Self: PartialEq<Self>,
impl<T: PartialEq> PartialEq<M22<T>> for M22<T>[src]
impl<T> StructuralPartialEq for M22<T>[src]
impl<T: Num + Copy> Sub<M22<T>> for M22<T>[src]
type Output = Self
The resulting type after applying the - operator.
fn sub(self, rhs: Self) -> Self[src]
impl<T: Num + Copy> SubAssign<M22<T>> for M22<T>[src]
fn sub_assign(&mut self, other: Self)[src]
impl<T: Num + Copy> Zero for M22<T>[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for M22<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for M22<T> where
T: Send,
T: Send,
impl<T> Sync for M22<T> where
T: Sync,
T: Sync,
impl<T> Unpin for M22<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for M22<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,