MatExt

Trait MatExt 

Source
pub trait MatExt: Sized + Copy {
    type Scalar;
    type Vector;
    type SymmetricEigen;
    type Svd;

    // Required methods
    fn abs(&self) -> Self;
    fn try_inverse(&self) -> Option<Self>;
    fn swap_cols(&mut self, a: usize, b: usize);
    fn swap_rows(&mut self, a: usize, b: usize);
    fn symmetric_eigen(&self) -> Self::SymmetricEigen;
    fn symmetric_eigenvalues(&self) -> Self::Vector;
    fn svd(&self) -> Self::Svd;
}
Expand description

Extension trait for square matrix types.

Provides additional functionality not available in glam:

  • abs() - element-wise absolute value
  • try_inverse() - inverse with singularity check
  • swap_cols() / swap_rows() - column/row swapping
  • symmetric_eigen() - eigendecomposition for symmetric matrices

Required Associated Types§

Source

type Scalar

The scalar type.

Source

type Vector

The vector type.

Source

type SymmetricEigen

The symmetric eigen decomposition type.

Source

type Svd

The Singular Values Decomposition type.

Required Methods§

Source

fn abs(&self) -> Self

Returns a matrix with all components set to their absolute values.

Source

fn try_inverse(&self) -> Option<Self>

Tries to invert the matrix, returning None if not invertible.

Source

fn swap_cols(&mut self, a: usize, b: usize)

Swaps two columns of this matrix.

Source

fn swap_rows(&mut self, a: usize, b: usize)

Swaps two rows of this matrix.

Source

fn symmetric_eigen(&self) -> Self::SymmetricEigen

Computes the symmetric eigendecomposition.

If self isn’t symmetric, expect incorrect results.

Source

fn symmetric_eigenvalues(&self) -> Self::Vector

Computes the eigenvalues of a symmetric matrix.

If self isn’t symmetric, expect incorrect results.

Source

fn svd(&self) -> Self::Svd

Computes the SVD of this matrix.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§