Skip to main content

Matrix2

Struct Matrix2 

Source
pub struct Matrix2<T: PhysicsQuantity> { /* private fields */ }

Implementations§

Source§

impl<T: PhysicsQuantity> Matrix2<T>

Source

pub fn new(data: [[T; 2]; 2]) -> Self

Source

pub fn zero() -> Self

Source

pub fn from_f64(data: [[f64; 2]; 2]) -> Self

Source

pub fn data(&self) -> [[T; 2]; 2]

Source

pub fn to_f64(&self) -> Matrix2<f64>

Source

pub fn get_column(&self, col: usize) -> Vector2<T>

Source

pub fn get_row(&self, row: usize) -> Vector2<T>

Source

pub fn transpose(&self) -> Matrix2<T>

Source

pub fn frobenius_norm(&self) -> T

Source

pub fn optimize(&mut self)

Source

pub fn abs(&self) -> Self

Source

pub fn to_ndarray(&self) -> Result<Array2<T>, String>

Source

pub fn from_ndarray(array: ArrayView2<'_, T>) -> Result<Self, String>

Source§

impl<T: PhysicsQuantity> Matrix2<T>

Source

pub fn dot<U, V>(&self, vec: &Vector2<U>) -> Vector2<V>
where T: Mul<U, Output = V>, U: PhysicsQuantity, V: PhysicsQuantity + Add<Output = V>,

Source§

impl<T, U> Matrix2<T>
where T: PhysicsQuantity + Mul<Output = U>, U: Add<Output = U> + Sub<Output = U> + PhysicsQuantity,

Source

pub fn det(&self) -> U

Source§

impl<T, U, V, R> Matrix2<T>
where T: PhysicsQuantity + Mul<T, Output = U> + Mul<U, Output = V> + Div<U, Output = R>, U: PhysicsQuantity + Mul<T, Output = V>, V: PhysicsQuantity, R: PhysicsQuantity,

Source

pub fn inverse(&self) -> Option<Matrix2<R>>

Source§

impl Matrix2<f64>

Trait Implementations§

Source§

impl<T: PhysicsQuantity + Add<Output = T>> Add for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<T: PhysicsQuantity + AddAssign> AddAssign for Matrix2<T>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<T: Clone + PhysicsQuantity> Clone for Matrix2<T>

Source§

fn clone(&self) -> Matrix2<T>

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 + PhysicsQuantity> Debug for Matrix2<T>

Source§

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

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

impl<T: PhysicsQuantity> Index<(usize, usize)> for Matrix2<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: (usize, usize)) -> &T

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

impl<T: PhysicsQuantity> IndexMut<(usize, usize)> for Matrix2<T>

Source§

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

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

impl<T, U, V> Mul<Matrix2<U>> for Matrix3x2<T>
where T: PhysicsQuantity + Mul<U, Output = V>, U: PhysicsQuantity, V: PhysicsQuantity + Add<Output = V>,

Source§

type Output = Matrix3x2<V>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Matrix2<U>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, U, V> Mul<Matrix2x3<U>> for Matrix2<T>
where T: PhysicsQuantity + Mul<U, Output = V>, U: PhysicsQuantity, V: PhysicsQuantity + Add<Output = V>,

Source§

type Output = Matrix2x3<V>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Matrix2x3<U>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, U, V> Mul<U> for Matrix2<T>
where T: PhysicsQuantity + Mul<U, Output = V>, U: PhysicsQuantity, V: PhysicsQuantity,

Source§

type Output = Matrix2<V>

The resulting type after applying the * operator.
Source§

fn mul(self, scalar: U) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: PhysicsQuantity + Neg<Output = T>> Neg for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T: PartialEq + PhysicsQuantity> PartialEq for Matrix2<T>

Source§

fn eq(&self, other: &Matrix2<T>) -> 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: PhysicsQuantity + Sub<Output = T>> Sub for Matrix2<T>

Source§

type Output = Matrix2<T>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<T: PhysicsQuantity + SubAssign> SubAssign for Matrix2<T>

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<T: Copy + PhysicsQuantity> Copy for Matrix2<T>

Source§

impl<T: PhysicsQuantity> StructuralPartialEq for Matrix2<T>

Auto Trait Implementations§

§

impl<T> Freeze for Matrix2<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Matrix2<T>
where T: RefUnwindSafe,

§

impl<T> Send for Matrix2<T>
where T: Send,

§

impl<T> Sync for Matrix2<T>
where T: Sync,

§

impl<T> Unpin for Matrix2<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Matrix2<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Matrix2<T>
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<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.