pub struct FixedMatrix<T, const R: usize, const C: usize> { /* private fields */ }Expand description
Stack-backed row-major fixed-size matrix.
Implementations§
Source§impl FixedMatrix<f64, 3, 3>
impl FixedMatrix<f64, 3, 3>
Sourcepub const fn from_row_major(data: [f64; 9]) -> Self
pub const fn from_row_major(data: [f64; 9]) -> Self
Create a 3x3 matrix from row-major storage.
Sourcepub const fn from_column_major(data: [f64; 9]) -> Self
pub const fn from_column_major(data: [f64; 9]) -> Self
Create a 3x3 matrix from column-major storage.
Sourcepub fn into_row_major(self) -> [f64; 9]
pub fn into_row_major(self) -> [f64; 9]
Return the matrix entries in row-major order.
Sourcepub fn into_column_major(self) -> [f64; 9]
pub fn into_column_major(self) -> [f64; 9]
Return the matrix entries in column-major order.
Sourcepub fn determinant(&self) -> f64
pub fn determinant(&self) -> f64
Determinant of a 3x3 matrix.
Sourcepub fn symmetric_eigen(&self) -> (FixedVector<f64, 3>, Self)
pub fn symmetric_eigen(&self) -> (FixedVector<f64, 3>, Self)
Eigendecomposition of a real symmetric 3x3 matrix.
Uses the analytic cubic formula (trigonometric solution of the depressed
cubic) for eigenvalues and the cross-product of (A - λI) columns for
eigenvectors. Eigenvalues are sorted descending; eigenvectors are
orthonormal columns of the returned matrix.
Sourcepub fn try_inverse(&self) -> Option<Self>
pub fn try_inverse(&self) -> Option<Self>
Inverse of a 3x3 matrix using the analytic cofactor formula.
Returns None when the matrix is singular (determinant ≈ 0).
Source§impl FixedMatrix<f64, 2, 2>
impl FixedMatrix<f64, 2, 2>
Sourcepub fn determinant(&self) -> f64
pub fn determinant(&self) -> f64
Determinant of a 2x2 matrix.
Sourcepub fn symmetric_eigen(&self) -> (FixedVector<f64, 2>, Self)
pub fn symmetric_eigen(&self) -> (FixedVector<f64, 2>, Self)
Eigendecomposition of a real symmetric 2x2 matrix.
Uses the closed-form quadratic formula. Eigenvalues are sorted descending; eigenvectors are orthonormal columns.
Sourcepub fn try_inverse(&self) -> Option<Self>
pub fn try_inverse(&self) -> Option<Self>
Inverse of a 2x2 matrix using cofactor formula.
Returns None when the matrix is singular (determinant ≈ 0).
Source§impl<T, const R: usize, const C: usize> FixedMatrix<T, R, C>
impl<T, const R: usize, const C: usize> FixedMatrix<T, R, C>
Source§impl<T, const R: usize, const C: usize> FixedMatrix<T, R, C>
impl<T, const R: usize, const C: usize> FixedMatrix<T, R, C>
Sourcepub fn transpose(&self) -> FixedMatrix<T, C, R>
pub fn transpose(&self) -> FixedMatrix<T, C, R>
Transpose the matrix.
Sourcepub fn from_columns(columns: [FixedVector<T, R>; C]) -> Self
pub fn from_columns(columns: [FixedVector<T, R>; C]) -> Self
Create a matrix from column vectors.
Sourcepub fn set_column(&mut self, column: usize, values: FixedVector<T, R>)
pub fn set_column(&mut self, column: usize, values: FixedVector<T, R>)
Replace one matrix column.
Source§impl<T, const N: usize> FixedMatrix<T, N, N>
impl<T, const N: usize> FixedMatrix<T, N, N>
Source§impl<T> FixedMatrix<T, 4, 4>
impl<T> FixedMatrix<T, 4, 4>
Sourcepub fn from_row_major(data: [T; 16]) -> Self
pub fn from_row_major(data: [T; 16]) -> Self
Create a 4×4 matrix from row-major storage.
Sourcepub fn from_column_major(data: [T; 16]) -> Self
pub fn from_column_major(data: [T; 16]) -> Self
Create a 4×4 matrix from column-major storage.
Sourcepub fn into_row_major(self) -> [T; 16]
pub fn into_row_major(self) -> [T; 16]
Return the matrix entries in row-major order.
Sourcepub fn into_column_major(self) -> [T; 16]
pub fn into_column_major(self) -> [T; 16]
Return the matrix entries in column-major order.
Sourcepub fn determinant(&self) -> T
pub fn determinant(&self) -> T
Determinant using cofactor expansion along the first row.
Sourcepub fn try_inverse(&self) -> Option<Self>
pub fn try_inverse(&self) -> Option<Self>
Inverse using the adjugate (cofactor matrix transpose) divided by the
determinant. Returns None when the matrix is singular.
Trait Implementations§
Source§impl<T, const R: usize, const C: usize> AddAssign for FixedMatrix<T, R, C>
impl<T, const R: usize, const C: usize> AddAssign for FixedMatrix<T, R, C>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read moreimpl<T: Copy, const R: usize, const C: usize> Copy for FixedMatrix<T, R, C>
Source§impl<T, const R: usize, const C: usize> DivAssign<T> for FixedMatrix<T, R, C>
impl<T, const R: usize, const C: usize> DivAssign<T> for FixedMatrix<T, R, C>
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/= operation. Read moreSource§impl<T, const R: usize, const K: usize, const C: usize> Mul<FixedMatrix<T, K, C>> for FixedMatrix<T, R, K>
impl<T, const R: usize, const K: usize, const C: usize> Mul<FixedMatrix<T, K, C>> for FixedMatrix<T, R, K>
Source§type Output = FixedMatrix<T, R, C>
type Output = FixedMatrix<T, R, C>
* operator.Source§impl<T, const R: usize, const C: usize> Mul<FixedVector<T, C>> for FixedMatrix<T, R, C>
impl<T, const R: usize, const C: usize> Mul<FixedVector<T, C>> for FixedMatrix<T, R, C>
Source§type Output = FixedVector<T, R>
type Output = FixedVector<T, R>
* operator.Source§impl<T, const R: usize, const C: usize> MulAssign<T> for FixedMatrix<T, R, C>
impl<T, const R: usize, const C: usize> MulAssign<T> for FixedMatrix<T, R, C>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*= operation. Read more