Trait geo_nd::SqMatrix

source ·
pub trait SqMatrix<V: Vector<F, D>, F: Float, const D: usize, const D2: usize>: Clone + Copy + Debug + Default + AsRef<[F; D2]> + AsMut<[F; D2]> + AsRef<[F]> + AsMut<[F]> + Add<Output = Self> + AddAssign + Sub<Output = Self> + SubAssign + Mul<Output = Self> + MulAssign + Mul<F, Output = Self> + MulAssign<F> + Div<F, Output = Self> + DivAssign<F> {
    // Required methods
    fn from_array(data: [F; D2]) -> Self;
    fn into_array(self) -> [F; D2];
    fn identity() -> Self;
    fn zero() -> Self;
    fn is_zero(&self) -> bool;
    fn set_zero(&mut self);
    fn transpose(&self) -> Self;
    fn determinant(&self) -> F;
    fn inverse(&self) -> Self;
    fn transform(&self, v: &V) -> V;
}
Expand description

The SqMatrix trait describes an N-dimensional square matrix of Float type that operates on a Vector.

This trait is not stable.

Such SqMatrix support basic arithmetic using addition and subtraction, and they provide component-wise multiplication and division, using the standard operators on two SqMatrixs.

They also support basic arithmetic to all components of the SqMatrix for addition, subtraction, multiplication and division by a scalar Float value type that they are comprised of. Hence a m:SqMatrix<F> may be scaled by a s:F using m * s.

Required Methods§

source

fn from_array(data: [F; D2]) -> Self

Create a SqMatrix from an array of Floats

source

fn into_array(self) -> [F; D2]

Create a vector from an array of Float

source

fn identity() -> Self

Create an identity SqMatrix

source

fn zero() -> Self

Create a zero SqMatrix

source

fn is_zero(&self) -> bool

Return true if the matrix is zer

source

fn set_zero(&mut self)

Set the matrix to zero

source

fn transpose(&self) -> Self

Return a transpose matrix

source

fn determinant(&self) -> F

Calculate the determinant of the matrix

source

fn inverse(&self) -> Self

Create an inverse matrix

source

fn transform(&self, v: &V) -> V

Apply the matrix to a vector to transform it

Implementors§

source§

impl<F: Float> SqMatrix<FArray<F, 2>, F, 2, 4> for FArray2<F, 2, 4>

source§

impl<F: Float> SqMatrix<FArray<F, 3>, F, 3, 9> for FArray2<F, 3, 9>

source§

impl<F: Float> SqMatrix<FArray<F, 4>, F, 4, 16> for FArray2<F, 4, 16>