Skip to main content

MultiVector

Trait MultiVector 

Source
pub trait MultiVector<T> {
    // Required methods
    fn grade_projection(&self, k: u32) -> Self
       where T: Field + Copy + Clone;
    fn reversion(&self) -> Self
       where T: Field + Copy + Clone + Neg<Output = T>;
    fn squared_magnitude(&self) -> T
       where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T>;
    fn inverse(&self) -> Result<Self, CausalMultiVectorError>
       where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T> + Div<Output = T> + PartialEq,
             Self: Sized;
    fn dual(&self) -> Result<Self, CausalMultiVectorError>
       where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T> + Div<Output = T> + PartialEq,
             Self: Sized;
    fn geometric_product(&self, rhs: &Self) -> Self
       where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T>;
    fn outer_product(&self, rhs: &Self) -> Self
       where T: Field + Copy + Clone + AddAssign + SubAssign;
    fn inner_product(&self, rhs: &Self) -> Self
       where T: Field + Copy + Clone + AddAssign + SubAssign;
    fn commutator_lie(&self, rhs: &Self) -> Self
       where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T>;
    fn commutator_geometric(&self, rhs: &Self) -> Self
       where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T> + Div<Output = T>;
    fn basis_shift(&self, index: usize) -> Self
       where T: Clone;
}

Required Methods§

Source

fn grade_projection(&self, k: u32) -> Self
where T: Field + Copy + Clone,

Projects the multivector onto a specific grade $k$.

$$ \langle A \rangle_k = \sum_{I : |I|=k} a_I e_I $$

Source

fn reversion(&self) -> Self
where T: Field + Copy + Clone + Neg<Output = T>,

Computes the reverse of the multivector, denoted $\tilde{A}$ or $A^\dagger$.

Reverses the order of vectors in each basis blade. $$ \tilde{A} = \sum_{k=0}^N (-1)^{k(k-1)/2} \langle A \rangle_k $$

Source

fn squared_magnitude(&self) -> T
where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T>,

Computes the squared magnitude (squared norm) of the multivector.

Source

fn inverse(&self) -> Result<Self, CausalMultiVectorError>
where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T> + Div<Output = T> + PartialEq, Self: Sized,

Computes the inverse of the multivector $A^{-1}$.

Source

fn dual(&self) -> Result<Self, CausalMultiVectorError>
where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T> + Div<Output = T> + PartialEq, Self: Sized,

Computes the dual of the multivector $A^*$.

Source

fn geometric_product(&self, rhs: &Self) -> Self
where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T>,

Computes the Geometric Product $AB$.

This is the fundamental operation of Clifford Algebra, combining the inner (contraction) and outer (expansion) products.

$$ AB = A \cdot B + A \wedge B $$

It is associative and distributive over addition.

Source

fn outer_product(&self, rhs: &Self) -> Self
where T: Field + Copy + Clone + AddAssign + SubAssign,

Computes the outer product (wedge product) $A \wedge B$.

The outer product of two multivectors of grades $r$ and $s$ is the grade $r+s$ part of their geometric product. $$ A \wedge B = \langle AB \rangle_{r+s} $$

For basis blades $e_I$ and $e_J$, $e_I \wedge e_J$ is non-zero only if $I \cap J = \emptyset$.

Source

fn inner_product(&self, rhs: &Self) -> Self
where T: Field + Copy + Clone + AddAssign + SubAssign,

Computes the inner product (left contraction) $A \cdot B$ (or $A \rfloor B$).

The inner product of a grade $r$ multivector $A$ and a grade $s$ multivector $B$ is the grade $s-r$ part of their geometric product. $$ A \cdot B = \langle AB \rangle_{s-r} $$

For basis blades $e_I$ and $e_J$, $e_I \cdot e_J$ is non-zero only if $I \subseteq J$.

Source

fn commutator_lie(&self, rhs: &Self) -> Self
where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T>,

Computes the Lie Bracket commutator $[A, B] = AB - BA$.

This is the standard definition for Lie Algebras (Particle Physics). For orthogonal basis vectors: $[e_1, e_2] = 2e_{12}$.

Source

fn commutator_geometric(&self, rhs: &Self) -> Self
where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T> + Div<Output = T>,

Computes the Geometric Algebra commutator product $A \times B = \frac{1}{2}(AB - BA)$.

This projects the result onto the subspace orthogonal to the inputs. For orthogonal basis vectors: $e_1 \times e_2 = e_{12}$.

Requirement: Type T must support division by 2 (e.g. 1 + 1).

Source

fn basis_shift(&self, index: usize) -> Self
where T: Clone,

Cyclically shifts the basis coefficients. This effectively changes the “viewpoint” of the algebra, making the coefficient at index the new scalar (index 0).

Used for Comonadic ‘extend’ operations.

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.

Implementations on Foreign Types§

Source§

impl MultiVector<f32> for f32

Source§

fn grade_projection(&self, k: u32) -> Self

Source§

fn reversion(&self) -> Self

Source§

fn squared_magnitude(&self) -> Self

Source§

fn inverse(&self) -> Result<Self, CausalMultiVectorError>
where Self: Sized,

Source§

fn dual(&self) -> Result<Self, CausalMultiVectorError>
where Self: Sized,

Source§

fn geometric_product(&self, rhs: &Self) -> Self

Source§

fn outer_product(&self, rhs: &Self) -> Self

Source§

fn inner_product(&self, rhs: &Self) -> Self

Source§

fn commutator_lie(&self, _rhs: &Self) -> Self

Source§

fn commutator_geometric(&self, _rhs: &Self) -> Self

Source§

fn basis_shift(&self, _index: usize) -> Self

Source§

impl MultiVector<f64> for f64

Source§

fn grade_projection(&self, k: u32) -> Self

Source§

fn reversion(&self) -> Self

Source§

fn squared_magnitude(&self) -> Self

Source§

fn inverse(&self) -> Result<Self, CausalMultiVectorError>
where Self: Sized,

Source§

fn dual(&self) -> Result<Self, CausalMultiVectorError>
where Self: Sized,

Source§

fn geometric_product(&self, rhs: &Self) -> Self

Source§

fn outer_product(&self, rhs: &Self) -> Self

Source§

fn inner_product(&self, rhs: &Self) -> Self

Source§

fn commutator_lie(&self, _rhs: &Self) -> Self

Source§

fn commutator_geometric(&self, _rhs: &Self) -> Self

Source§

fn basis_shift(&self, _index: usize) -> Self

Implementors§