Skip to main content

CausalMultiVector

Struct CausalMultiVector 

Source
pub struct CausalMultiVector<T> { /* private fields */ }
Expand description

A MultiVector in a Clifford Algebra $Cl(p, q, r)$.

A multivector $A$ is a linear combination of basis blades $e_I$: $$ A = \sum_{I} a_I e_I $$ where $I$ is an ordered subset of ${1, \dots, N}$ and $a_I$ are scalar coefficients.

The data is stored in a flat vector of size $2^N$. Indexing is based on bitmaps: index 3 (binary 011) corresponds to the basis blade $e_1 \wedge e_2$.

Implementations§

Source§

impl CausalMultiVector<Complex<f64>>

Source

pub fn new_complex_pauli(data: Vec<Complex64>) -> Self

Cl_C(2): Complex Quaternions / Pauli Algebra over C Note: The Clifford factor L_C ~ Cl(0, 1) and L_H ~ Cl(0, 2) are negative definite. However, the canonical complex Pauli Algebra is often taken as Cl(2, 0). We retain Euclidean(2) here for the canonical Cl_C(2) ~ Cl(2, 0) definition.

Source

pub fn new_complex_clifford_2(data: Vec<Complex64>) -> Self

Cl_C(2): Complex Quaternions / Pauli Algebra over C Note: The Clifford factor L_C ~ Cl(0, 1) and L_H ~ Cl(0, 2) are negative definite. However, the canonical complex Pauli Algebra is often taken as Cl(2, 0). We retain Euclidean(2) here for the canonical Cl_C(2) ~ Cl(2, 0) definition.

Source

pub fn new_quaternion_operator(data: Vec<Complex64>) -> Self

Cl_C(4) (Full Multiplication Algebra of the Quaternions, M_H ~ Cl(0, 4)). This algebra hosts the Spin(4) ~ SU(2)_L * SU(2)_R symmetries of the Pati-Salam and LR Symmetric models. It is a key building block for the electroweak sector.

Source

pub fn new_complex_clifford_4(data: Vec<Complex64>) -> Self

Cl_C(4) (Full Multiplication Algebra of the Quaternions, M_H ~ Cl(0, 4)). This algebra hosts the Spin(4) ~ SU(2)_L * SU(2)_R symmetries of the Pati-Salam and LR Symmetric models. It is a key building block for the electroweak sector.

Source

pub fn new_octonion_operator(data: Vec<Complex64>) -> Self

Cl_C(6): The algebra acting on Octonions (via Left Multiplication), L_O ~ Cl(0, 6) Used for the initial decomposition in the paper (Spin(10) -> Pati-Salam).

Source

pub fn new_complex_clifford_6(data: Vec<Complex64>) -> Self

Cl_C(6): The algebra acting on Octonions (via Left Multiplication), L_O ~ Cl(0, 6) Used for the initial decomposition in the paper (Spin(10) -> Pati-Salam).

Source

pub fn new_dixon_state_space(data: Vec<Complex64>) -> Self

Cl_C(6): The algebra of the Dixon state space, A = CHO ~ Cl(0, 6) This is used to host the 64 complex components of the Standard Model generations.

Source

pub fn new_dixon_algebra_left(data: Vec<Complex64>) -> Self

Cl_C(8): The Left Multiplication Algebra of the Dixon Algebra, L_A ~ Cl(0, 8) L_A = L_C * L_H * L_O ~ Cl(0, 1) * Cl(0, 2) * Cl(0, 6) ~ Cl(0, 8). This is used to host Spin(8) triality and the Cl(6) decomposition.

Source

pub fn new_complex_clifford_8(data: Vec<Complex64>) -> Self

Cl_C(8): The Left Multiplication Algebra of the Dixon Algebra, L_A ~ Cl(0, 8) L_A = L_C * L_H * L_O ~ Cl(0, 1) * Cl(0, 2) * Cl(0, 6) ~ Cl(0, 8). This is used to host Spin(8) triality and the Cl(6) decomposition.

Source

pub fn new_gut_algebra(data: Vec<Complex64>) -> Self

Cl_C(10): The Grand Unified Algebra (Spin(10)) ~ L_A * R_H ~ Cl(0, 10) This is the full multiplication algebra of A = RCH*O.

Source

pub fn new_complex_clifford_10(data: Vec<Complex64>) -> Self

Cl_C(10): The Grand Unified Algebra (Spin(10)) ~ L_A * R_H ~ Cl(0, 10) This is the full multiplication algebra of A = RCH*O.

Source§

impl CausalMultiVector<f64>

Source

pub fn new_point(x: f64, y: f64, z: f64) -> Self

Creates a point in 3D Projective Geometric Algebra (PGA).

The point $\mathbf{P}=(x, y, z, w)$ is represented as a tri-vector (dual basis).

$$\mathbf{P} = x \mathbf{e}{032} + y \mathbf{e}{013} + z \mathbf{e}{021} + w \mathbf{e}{123}$$

For a homogeneous point at $(x, y, z)$ (i.e., $w=1$), the internal data mapping is:

ComponentMathematical BladeCanonical Blade (Index)Coefficient
$w$$\mathbf{e}_{123}$$\mathbf{e}_{123}$ (Index 14)$1.0$
$x$$\mathbf{e}_{032}$$-\mathbf{e}_{023}$ (Index 13)$-x$
$y$$\mathbf{e}_{013}$$\mathbf{e}_{013}$ (Index 11)$y$
$z$$\mathbf{e}_{021}$$-\mathbf{e}_{012}$ (Index 7)$-z$

Note: The signs for $x$ and $z$ are flipped to align $\mathbf{e}{032}$ and $\mathbf{e}{021}$ with the canonical basis ordering assumed by the multivector indices.

Source

pub fn translator(x: f64, y: f64, z: f64) -> Self

Creates a translator (motor) in 3D PGA.

A translator $T$ moves geometry by a vector $d = (x, y, z)$. $$ T = 1 - \frac{1}{2} (x e_{01} + y e_{02} + z e_{03}) $$

Indices:

  • Scalar (0): 1.0
  • e01 (3): -x/2
  • e02 (5): -y/2
  • e03 (9): -z/2
Source§

impl CausalMultiVector<f64>

Source

pub fn new_euclidean(data: Vec<f64>, dim: usize) -> Self

Cl(N, 0): Generic N-dimensional Euclidean algebra. All basis vectors square to +1.

Source§

impl CausalMultiVector<f64>

Source

pub fn new_complex_number(real: f64, imag: f64) -> Self

Cl(0, 1): Isomorphic to Complex Numbers C Basis: {1, e1} where e1^2 = -1 (acts as i)

Source

pub fn new_split_complex(a: f64, b: f64) -> Self

Cl(1, 0): Isomorphic to Split-Complex (Hyperbolic) Numbers Basis: {1, e1} where e1^2 = +1 (acts as j)

Source

pub fn new_quaternion(w: f64, x: f64, y: f64, z: f64) -> Self

Cl(0, 2): Isomorphic to Quaternions H Basis: {1, e1, e2, e12}. e1^2 = e2^2 = -1.

Source

pub fn new_split_quaternion(a: f64, b: f64, c: f64, d: f64) -> Self

Cl(2, 0): Isomorphic to Split-Quaternions (Coquaternions) or M(2,R) Basis: {1, e1, e2, e12} where e1^2 = 1, e2^2 = 1.

This algebra is often used in representing 2D isometries.

Source§

impl CausalMultiVector<f64>

Source

pub fn new_aps_vector(data: Vec<f64>) -> Self

Cl(3, 0): Algebra of Physical Space (APS) / Pauli Algebra Used for non-relativistic quantum mechanics (Pauli Matrices).

Source

pub fn new_spacetime_algebra_1_3(data: Vec<f64>) -> Self

Cl(1, 3): Space-Time Algebra (STA) / Dirac Algebra Physics Convention: Time-like vector is positive. Metric: (+ - - -) This is a specialized case of Metric::Generic { p: 1, q: 3, r: 0 }.

Source

pub fn new_spacetime_algebra_3_1(data: Vec<f64>) -> Self

Cl(3, 1): Spacetime Algebra (STA) / Dirac Algebra Mathematics/GR Convention: Space-like vectors are positive. Metric: (- + + +) This is a specialized case of Metric::Generic { p: 3, q: 1, r: 0 }.

Source

pub fn new_cga_vector(data: Vec<f64>) -> Self

Cl(4, 1): Conformal Geometric Algebra (CGA) Used for computer graphics and advanced robotics. 5 Dimensions. Metric (+ + + + -).

Basis: e1, e2, e3, e+ (e4), e- (e5). e5^2 = -1.

Source§

impl<T> CausalMultiVector<T>
where T: AbelianGroup + Copy,

Source

pub fn zero(metric: Metric) -> Self

Creates a Zero vector (Additive Identity).

Source

pub fn add(&self, rhs: &Self) -> Self

Element-wise Addition. Checks metric compatibility.

Source

pub fn sub(&self, rhs: &Self) -> Self

Element-wise Subtraction.

Source§

impl<T> CausalMultiVector<T>

Source

pub fn scale<S>(&self, scalar: S) -> Self
where T: Module<S> + Copy, S: Ring + Copy,

Scales the multivector by a scalar value. $v’ = s \cdot v$

Source§

impl<T> CausalMultiVector<T>
where T: AssociativeRing + Copy,

Source

pub fn geometric_product_general(&self, rhs: &Self) -> Self

Generalized Geometric Product.

Unlike the standard product, this does NOT assume coefficients commute. $ (a e_i) (b e_j) = (a b) (e_i e_j) $

It strictly preserves the order lhs * rhs for coefficients. This allows CausalMultiVector<Quaternion> or CausalMultiVector<Matrix>.

Source§

impl<T> CausalMultiVector<T>
where T: RealField + Copy,

Source

pub fn normalize(&self) -> Self

Normalizes the multivector to unit magnitude.

Source§

impl<T> CausalMultiVector<T>
where T: Field + Copy + RealField,

Source

pub fn commutator(&self, rhs: &Self) -> Self

Computes the Lie Commutator: $[A, B] = AB - BA$. Valid for all associative algebras.

Source

pub fn inverse(&self) -> Result<Self, CausalMultiVectorError>

Computes the Multiplicative Inverse. $A^{-1} = \tilde{A} / |A|^2$ (For Versors). Requires Division (Field).

Source

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

The Geometric Product for Commutative Coefficients. This is the standard CPU implementation.

Source

pub fn euclidean_squared_magnitude_3d(&self) -> T

Computes the Euclidean squared magnitude of a 3D spatial vector.

For 4D Lorentzian multivectors with spatial components at indices 2, 3, 4 (corresponding to x, y, z), this returns:

$$ |v|^2_{\text{Euclidean}} = v_x^2 + v_y^2 + v_z^2 $$

This differs from squared_magnitude() which applies the Lorentzian metric signature, potentially yielding negative values for spatial vectors.

§Use Case

Use this for classical EM quantities like energy density where the physical norm must be positive-definite.

Source

pub fn euclidean_magnitude_3d(&self) -> T

Computes the Euclidean magnitude of a 3D spatial vector.

$$ |v|_{\text{Euclidean}} = \sqrt{v_x^2 + v_y^2 + v_z^2} $$

Source

pub fn euclidean_cross_product_3d(&self, rhs: &Self) -> Self

Computes the 3D Euclidean cross product of two spatial vectors.

For vectors with spatial components at indices 2, 3, 4 (x, y, z):

$$ \mathbf{a} \times \mathbf{b} = (a_y b_z - a_z b_y, a_z b_x - a_x b_z, a_x b_y - a_y b_x) $$

The result is returned in the same multivector format with the cross product components at indices 2, 3, 4.

§Use Case

Use this for classical EM quantities like the Poynting vector S = E × B.

Source§

impl<T> CausalMultiVector<T>
where T: Field + Copy + Default + PartialOrd + Neg<Output = T>,

Source

pub fn to_matrix(&self) -> CausalTensor<T>

Converts this multivector to matrix representation.

Source

pub fn from_matrix(matrix: CausalTensor<T>, metric: Metric) -> Self

Converts Matrix Representation back to coefficients.

Uses trace projection: aᵢ = Tr(M · Γᵢ†) / matrix_dim

Source

pub fn get_gamma_matrix(&self, blade_idx: usize) -> CausalTensor<T>

Gets the gamma matrix for a specific blade index.

Source§

impl<T> CausalMultiVector<T>

Source

pub fn new(data: Vec<T>, metric: Metric) -> Result<Self, CausalMultiVectorError>

Creates a new MultiVector from raw coefficients.

§Arguments
  • data - A vector of coefficients of size $2^N$.
  • metric - The metric signature of the algebra.
§Returns
  • Result<Self, CausalMultiVectorError> - The new multivector or an error if the data length is incorrect.
Source

pub fn unchecked(data: Vec<T>, metric: Metric) -> Self

Source

pub fn get(&self, idx: usize) -> Option<&T>

Gets a specific component by basis blade bitmap.

§Arguments
  • idx - The bitmap index of the basis blade (e.g., 3 for $e_1 \wedge e_2$).
Source

pub fn scalar(val: T, metric: Metric) -> Self
where T: Zero + Copy + Clone,

Creates a scalar multivector (grade 0).

$$ A = s \cdot 1 $$

§Arguments
  • val - The scalar value.
  • metric - The metric signature.
Source

pub fn pseudoscalar(metric: Metric) -> Self
where T: Field + Copy + Clone,

Constructs the pseudoscalar $I$ for the algebra.

The pseudoscalar is the highest grade element, corresponding to the product of all basis vectors: $$ I = e_1 \wedge e_2 \wedge \dots \wedge e_N $$

Source

pub fn data(&self) -> &Vec<T>

Source

pub fn metric(&self) -> Metric

Trait Implementations§

Source§

impl<'b, T> Add<&'b CausalMultiVector<T>> for &CausalMultiVector<T>
where T: Copy + Add<Output = T> + Zero,

Source§

type Output = CausalMultiVector<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'b CausalMultiVector<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add for CausalMultiVector<T>
where T: Add<Output = T> + Copy + Clone + PartialEq,

Implements component-wise addition of multivectors. $$ A + B = \sum_{I} (a_I + b_I) e_I $$

Source§

type Output = CausalMultiVector<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, T> AddAssign<&'a CausalMultiVector<T>> for CausalMultiVector<T>
where T: AddAssign + Copy + Clone + PartialEq,

Source§

fn add_assign(&mut self, rhs: &'a CausalMultiVector<T>)

Performs the += operation. Read more
Source§

impl<T> AddAssign for CausalMultiVector<T>
where T: AddAssign + Copy + Clone + PartialEq,

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for CausalMultiVector<T>

Source§

fn clone(&self) -> CausalMultiVector<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for CausalMultiVector<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Div<T> for &CausalMultiVector<T>
where T: Copy + Div<Output = T>,

Source§

type Output = CausalMultiVector<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<T> for CausalMultiVector<T>
where T: Div<Output = T> + Copy + Clone,

Implements scalar division. $$ A / s = \sum_{I} (a_I / s) e_I $$

Source§

type Output = CausalMultiVector<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<'b, T> Mul<&'b CausalMultiVector<T>> for &CausalMultiVector<T>
where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T>,

Reference geometric product &A * &B (CPU-only).

Source§

type Output = CausalMultiVector<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'b CausalMultiVector<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<T> for &CausalMultiVector<T>
where T: Copy + Mul<Output = T>,

Source§

type Output = CausalMultiVector<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<T> for CausalMultiVector<T>
where T: Mul<Output = T> + Copy + Clone,

Implements scalar multiplication. $$ A s = \sum_{I} (a_I s) e_I $$

Source§

type Output = CausalMultiVector<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul for CausalMultiVector<T>
where T: Field + Copy + Clone + AddAssign + SubAssign + Neg<Output = T>,

Geometric product via * operator (CPU-only).

Source§

type Output = CausalMultiVector<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> MulAssign<T> for CausalMultiVector<T>
where T: MulAssign + Copy + Clone,

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<T> MultiVector<T> for CausalMultiVector<T>

Source§

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

Projects the multivector onto a specific grade $k$. Read more
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$. Read more
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 + Neg<Output = T> + Div<Output = T> + PartialEq + AddAssign + SubAssign,

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

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

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$. Read more
Source§

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

Computes the outer product (wedge product) $A \wedge B$. Read more
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$). Read more
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$. Read more
Source§

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

Computes the Geometric Algebra commutator product $A \times B = \frac{1}{2}(AB - BA)$. Read more
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). Read more
Source§

impl<T> MultiVectorL2Norm<T> for CausalMultiVector<T>
where T: Field + Copy + Sum + ScalarEval,

Source§

type Output = <T as ScalarEval>::Real

Returns the Real magnitude type (e.g. f64 for Complex<f64>)
Source§

fn norm_l2(&self) -> Self::Output

Computes the L2 norm (Euclidean length) of the multivector’s coefficient vector. Read more
Source§

fn normalize_l2(&self) -> Self

Normalizes the multivector’s coefficient vector to have a unit L2 norm. Read more
Source§

impl<T: PartialEq> PartialEq for CausalMultiVector<T>

Source§

fn eq(&self, other: &CausalMultiVector<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'b, T> Sub<&'b CausalMultiVector<T>> for &CausalMultiVector<T>
where T: Copy + Sub<Output = T> + Zero,

Source§

type Output = CausalMultiVector<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'b CausalMultiVector<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub for CausalMultiVector<T>
where T: Sub<Output = T> + Copy + Clone + PartialEq,

Implements component-wise subtraction of multivectors. $$ A - B = \sum_{I} (a_I - b_I) e_I $$

Source§

type Output = CausalMultiVector<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> StructuralPartialEq for CausalMultiVector<T>

Auto Trait Implementations§

§

impl<T> Freeze for CausalMultiVector<T>

§

impl<T> RefUnwindSafe for CausalMultiVector<T>
where T: RefUnwindSafe,

§

impl<T> Send for CausalMultiVector<T>
where T: Send,

§

impl<T> Sync for CausalMultiVector<T>
where T: Sync,

§

impl<T> Unpin for CausalMultiVector<T>
where T: Unpin,

§

impl<T> UnwindSafe for CausalMultiVector<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AddMagma for T
where T: Add<Output = T> + AddAssign + Clone + PartialEq,

Source§

impl<T> MulMagma for T
where T: Mul<Output = T> + Clone,

Source§

impl<T> Satisfies<NoConstraint> for T