pub struct Multivector<const P: usize, const Q: usize, const R: usize, const N: usize> {
pub coords: [f32; N],
}Expand description
Fixed-size stack-allocated Multivector in Clifford Algebra Cl(p, q, r).
- P, Q, R: Metric signature.
- N: Algebra dimension (2^(P + Q + R)).
Fields§
§coords: [f32; N]Implementations§
Source§impl<const P: usize, const Q: usize, const R: usize, const N: usize> Multivector<P, Q, R, N>
impl<const P: usize, const Q: usize, const R: usize, const N: usize> Multivector<P, Q, R, N>
Sourcepub fn from_scalar(alpha: f32) -> Self
pub fn from_scalar(alpha: f32) -> Self
Scalar multivector: alpha * 1.
Sourcepub fn from_vector(vec: &[f32]) -> Self
pub fn from_vector(vec: &[f32]) -> Self
Creates a 1-vector from coordinate slice.
Sourcepub fn grade_projection(&self, grade: usize) -> Self
pub fn grade_projection(&self, grade: usize) -> Self
Extracts the k-th grade projection _k.
Sourcepub fn grade_involution(&self) -> Self
pub fn grade_involution(&self) -> Self
Grade Involution: A^ = sum (-1)^k _k.
Sourcepub fn conjugation(&self) -> Self
pub fn conjugation(&self) -> Self
Clifford Conjugation: \bar{A} = sum (-1)^{k(k+1)/2} _k.
Sourcepub fn geometric_product(&self, rhs: &Self) -> Self
pub fn geometric_product(&self, rhs: &Self) -> Self
Computes the Clifford Geometric Product: C = A * B.
Sourcepub fn left_contraction(&self, rhs: &Self) -> Self
pub fn left_contraction(&self, rhs: &Self) -> Self
Computes the Left Contraction: C = A _| B.
Sourcepub fn right_contraction(&self, rhs: &Self) -> Self
pub fn right_contraction(&self, rhs: &Self) -> Self
Computes the Right Contraction: C = A |_ B.
Sourcepub fn scalar_product(&self, rhs: &Self) -> f32
pub fn scalar_product(&self, rhs: &Self) -> f32
Scalar product <A, B> = <A B~>_0.
Sourcepub fn pseudoscalar() -> Self
pub fn pseudoscalar() -> Self
Returns the unit pseudoscalar I = e_1 ^ e_2 ^ … ^ e_n.
Sourcepub fn pseudoscalar_inverse() -> Option<Self>
pub fn pseudoscalar_inverse() -> Option<Self>
Computes the pseudoscalar inverse I^{-1} for non-degenerate metrics (R == 0). Under signature (P, Q, 0): I^2 = (-1)^{n(n-1)/2 + Q}, so I^{-1} = I * (-1)^{n(n-1)/2 + Q}.
Sourcepub fn dual(&self) -> Option<Self>
pub fn dual(&self) -> Option<Self>
Computes the Hodge Dual: A* = A I^{-1} (Macdonald Def 6.16, Hestenes Section 1.2).
Sourcepub fn commutator(&self, rhs: &Self) -> Self
pub fn commutator(&self, rhs: &Self) -> Self
Computes the Lie Commutator Product: [A, B] = 1/2 (A B - B A) (Hestenes Eq 1.55). Anticommutative: [A, B] = -[B, A]. Satisfies the Jacobi identity.
Sourcepub fn anticommutator(&self, rhs: &Self) -> Self
pub fn anticommutator(&self, rhs: &Self) -> Self
Computes the Jordan Anticommutator (symmetric product): A ⊙ B = 1/2 (A B + B A).
Sourcepub fn regressive_product(&self, rhs: &Self) -> Option<Self>
pub fn regressive_product(&self, rhs: &Self) -> Option<Self>
Computes the Regressive (Meet) Product: A ∨ B = (A* ∧ B*).undual() In non-degenerate spaces, gives the geometric intersection of blade subspaces.
Sourcepub fn hestenes_inner_product(&self, rhs: &Self) -> Self
pub fn hestenes_inner_product(&self, rhs: &Self) -> Self
Computes the Hestenes Inner Product (Fat Dot): A • B = sum_{r>=1, s>=1} < _r s >{|r - s|}. As defined in Hestenes & Sobczyk (1984), Section 1.1, Eq. 1.8.
Sourcepub fn inverse(&self) -> Option<Self>
pub fn inverse(&self) -> Option<Self>
Computes the exact closed-form algebraic inverse A^{-1} for multivectors:
- For Cl(2, 0, 0): A^{-1} = \bar{A} / (A \bar{A})_0
- For Cl(3, 0, 0): A^{-1} = \bar{A} (A \bar{A})~ / det(A)
- General fallback for versors: A~ / ||A||^2 Returns None if multivector is singular (det(A) == 0).
Trait Implementations§
Source§impl<const P: usize, const Q: usize, const R: usize, const N: usize> Add for Multivector<P, Q, R, N>
impl<const P: usize, const Q: usize, const R: usize, const N: usize> Add for Multivector<P, Q, R, N>
Source§impl<const P: usize, const Q: usize, const R: usize, const N: usize> AddAssign for Multivector<P, Q, R, N>
impl<const P: usize, const Q: usize, const R: usize, const N: usize> AddAssign for Multivector<P, Q, R, N>
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+= operation. Read more