[][src]Struct quick_maths::Matrix

pub struct Matrix<const M: usize, const N: usize, T = DefaultFloat>(pub Vector<N, Vector<M, T>>);

A matrix, where each vector represents a column

Implementations

impl<T, const M: usize, const N: usize> Matrix<M, N, T>[src]

pub fn y_x_iter(&self) -> impl Iterator<Item = &T> + '_[src]

Top-Bottom, Left-Right iterator.

pub fn x_y_iter(&self) -> impl Iterator<Item = &T> + '_[src]

Left-Right, Top-Bottom iterator.

pub fn col_iter(&self) -> impl Iterator<Item = &Vector<M, T>>[src]

impl<T: Float, const M: usize, const N: usize> Matrix<M, N, T>[src]

pub fn dot(&self, vec: &Vector<N, T>) -> Vector<M, T>[src]

pub fn t(&self) -> Matrix<N, M, T>[src]

pub fn matmul<const P: usize>(&self, o: &Matrix<N, P, T>) -> Matrix<M, P, T>[src]

Performs naive matrix multiplication

pub fn swap_rows(&mut self, cols: Range<usize>, a: usize, b: usize)[src]

pub fn swap_cols(&mut self, a: usize, b: usize)[src]

pub fn apply_fn<F, S>(&self, f: F) -> Matrix<M, N, S> where
    F: FnMut(T) -> S + Copy,
    S: Float
[src]

pub fn zxtend<const I: usize, const J: usize>(&self) -> Matrix<I, J, T>[src]

Zero extend this matrix to a larger size

pub fn reduce<const I: usize, const J: usize>(&self) -> Matrix<I, J, T>[src]

Take some subset of this matrix(only takes from the topt left)

pub fn frobenius(&self) -> T[src]

impl<T: Float, const M: usize> Matrix<M, M, T>[src]

pub fn from_diag(v: Vector<M, T>) -> Self[src]

Creates a square matrix from a diagonal

pub fn diag(&self) -> impl Iterator<Item = T> + '_[src]

Returns elements on the diagonal from top left to bottom right

pub fn off_diag(&self) -> impl Iterator<Item = T> + '_[src]

Returns elements not on the diagonal in no specific order

pub fn ixtend<const I: usize>(&self) -> Matrix<I, I, T>[src]

Identity extend this matrix to a larger size(ones along diagonal)

pub fn trace(&self) -> T[src]

pub fn lup(&self) -> (Self, Self, Self)[src]

LUP decomposes self into lower triangular, upper triangular and pivot matrix

pub fn usolve(&self, b: &Vector<M, T>) -> Vector<M, T>[src]

Given an upper triangular matrix and a vector, compute the solution to the system of equations

pub fn lsolve(&self, b: &Vector<M, T>) -> Vector<M, T>[src]

Given a lower triangular matrix and a vector, compute the solution to the system of equations

pub fn solve((l, u, p): &(Self, Self, Self), b: &Vector<M, T>) -> Vector<M, T>[src]

Solves for x in the linear system Ax = b;

impl<T: Float> Matrix<3_usize, 3_usize, T>[src]

pub fn new(c0: Vec3<T>, c1: Vec3<T>, c2: Vec3<T>) -> Self[src]

pub fn det(&self) -> T[src]

Computes the determinant of this matrix

pub fn inv(&self) -> Self[src]

Inverts this matrix, does not handle non-invertible matrices

pub fn rot(around: &Vec3<T>, cos_t: T) -> Self[src]

pub fn scale(by: &Vec3<T>) -> Self[src]

pub fn translate(by: &Vec2<T>) -> Self[src]

Translation operator for 2 space

pub fn project(normal: &Vec3<T>) -> Self[src]

pub fn from_quat(q: Quat<T>) -> Self[src]

https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation Converts a quaternion into an equivalent matrix

impl<T: Float> Matrix<2_usize, 2_usize, T>[src]

pub fn det(&self) -> T[src]

Computes the determinant of this matrix

pub fn inv(&self) -> Self[src]

Inverts this matrix, does not handle non-invertible matrices

pub fn rot(theta: T) -> Self[src]

Returns the rotation matrix given a theta in the counterclockwise direction

pub fn scale(sx: T, sy: T) -> Self[src]

Returns the scale matrix given scale in each direction

impl<T: Float> Matrix<4_usize, 4_usize, T>[src]

pub fn new(c0: Vec4<T>, c1: Vec4<T>, c2: Vec4<T>, c3: Vec4<T>) -> Self[src]

pub fn translate(t: Vec3<T>) -> Self[src]

Returns a translation matrix by t

pub fn translation(&self) -> Vec3<T>[src]

Returns the translation encoded in this matrix

pub fn inv(&self) -> Self[src]

Computes the inverse of this matrix if it exists

pub fn p_inv(&self) -> Self[src]

Returns the pseudo-inverse of this matrix

impl<T, const M: usize> Matrix<M, 1, T>[src]

pub fn squeeze(self) -> Vector<M, T>[src]

impl<T: Float, const M: usize, const N: usize> Matrix<M, N, T>[src]

pub fn cos(&self) -> Self[src]

Element-wise cos .

pub fn sin(&self) -> Self[src]

Element-wise sin .

pub fn tan(&self) -> Self[src]

Element-wise tan .

pub fn acos(&self) -> Self[src]

Element-wise acos .

pub fn asin(&self) -> Self[src]

Element-wise asin .

pub fn atan(&self) -> Self[src]

Element-wise atan .

pub fn acosh(&self) -> Self[src]

Element-wise acosh .

pub fn asinh(&self) -> Self[src]

Element-wise asinh .

pub fn atanh(&self) -> Self[src]

Element-wise atanh .

pub fn atan2(&self, v: T) -> Self[src]

Element-wise atan2 .

pub fn hypot(&self, v: T) -> Self[src]

Element-wise hypot .

pub fn ceil(&self) -> Self[src]

Element-wise ceil .

pub fn floor(&self) -> Self[src]

Element-wise floor .

pub fn round(&self) -> Self[src]

Element-wise round .

pub fn fract(&self) -> Self[src]

Element-wise fract .

pub fn trunc(&self) -> Self[src]

Element-wise trunc .

pub fn abs_sub(&self, v: T) -> Self[src]

Element-wise abs_sub .

pub fn abs(&self) -> Self[src]

Element-wise abs .

pub fn signum(&self) -> Self[src]

Element-wise signum .

pub fn recip(&self) -> Self[src]

Element-wise recip .

pub fn log2(&self) -> Self[src]

Element-wise log2 .

pub fn log10(&self) -> Self[src]

Element-wise log10 .

pub fn ln(&self) -> Self[src]

Element-wise ln .

pub fn ln_1p(&self) -> Self[src]

Element-wise ln_1p .

pub fn exp(&self) -> Self[src]

Element-wise exp .

pub fn exp2(&self) -> Self[src]

Element-wise exp2 .

pub fn exp_m1(&self) -> Self[src]

Element-wise exp_m1 .

pub fn sqrt(&self) -> Self[src]

Element-wise sqrt .

pub fn cbrt(&self) -> Self[src]

Element-wise cbrt .

pub fn powf(&self, v: T) -> Self[src]

Element-wise powf .

pub fn powi(&self, v: i32) -> Self[src]

pub fn log(&self, v: T) -> Self[src]

Element-wise log .

pub fn max(&self, v: T) -> Self[src]

Element-wise max .

pub fn min(&self, v: T) -> Self[src]

Element-wise min .

pub fn to_degrees(&self) -> Self[src]

Element-wise to_degrees .

pub fn to_radians(&self) -> Self[src]

Element-wise to_radians .

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

pub fn dyn_tensor(self) -> DynTensor<2, T>[src]

Trait Implementations

impl<T: Float, const M: usize, const N: usize> Add<Matrix<M, N, T>> for Matrix<M, N, T>[src]

type Output = Self

The resulting type after applying the + operator.

impl<T: Float, const M: usize, const N: usize> Add<T> for Matrix<M, N, T>[src]

type Output = Self

The resulting type after applying the + operator.

impl<const M: usize, const N: usize, T: Clone> Clone for Matrix<M, N, T>[src]

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

impl<const M: usize, const N: usize, T: Debug> Debug for Matrix<M, N, T>[src]

impl<T: Float, const M: usize, const N: usize> Div<Matrix<M, N, T>> for Matrix<M, N, T>[src]

type Output = Self

The resulting type after applying the / operator.

impl<T: Float, const M: usize, const N: usize> Div<T> for Matrix<M, N, T>[src]

type Output = Self

The resulting type after applying the / operator.

impl<const M: usize, const N: usize, T: Eq> Eq for Matrix<M, N, T>[src]

impl<T, const M: usize, const N: usize> Index<usize> for Matrix<M, N, T>[src]

type Output = Vector<M, T>

The returned type after indexing.

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

impl<T: Float, const M: usize, const N: usize> Mul<Matrix<M, N, T>> for Matrix<M, N, T>[src]

type Output = Self

The resulting type after applying the * operator.

impl<T: Float, const M: usize, const N: usize> Mul<T> for Matrix<M, N, T>[src]

type Output = Self

The resulting type after applying the * operator.

impl<T: Float, const M: usize> One for Matrix<M, M, T>[src]

Multiplicative identity

impl<const M: usize, const N: usize, T: PartialEq> PartialEq<Matrix<M, N, T>> for Matrix<M, N, T>[src]

impl<const M: usize, const N: usize, T> StructuralEq for Matrix<M, N, T>[src]

impl<const M: usize, const N: usize, T> StructuralPartialEq for Matrix<M, N, T>[src]

impl<T: Float, const M: usize, const N: usize> Sub<Matrix<M, N, T>> for Matrix<M, N, T>[src]

type Output = Self

The resulting type after applying the - operator.

impl<T: Float, const M: usize, const N: usize> Sub<T> for Matrix<M, N, T>[src]

type Output = Self

The resulting type after applying the - operator.

impl<T: Float, const M: usize, const N: usize> Zero for Matrix<M, N, T>[src]

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.