┌───────────────────────────────────────────────────────┐
│ │
│ ▁▁▁▁ ▁▁▁▁ │
│ ╲ ╲ ╱ ╱ │
│ ╲ ╲ ╱ ╱ │
│ ╲ ╲ ╱ ╱ │
│ ╲ ╲ ╱ ╱ │
│ ╲ ╲ ╱ ╱ │
│ ╲▁▁▁▁╲╱ ╱ │
│ ╱ ╱ │
│ ╱▁▁▁▁╱ │
│ │
│ · V e r s o r C - M a t h · │
│ │
└───────────────────────────────────────────────────────┘
VERSORC-MATH: High-Performance Clifford Geometric Algebra & Versor Engine
VERSORC-MATH is an open-source, community-driven Clifford Geometric Algebra (GA), Versor Operator, and Geometric Quantization engine written in pure Rust with zero required runtime dependencies. It provides high-performance native PyO3 / NumPy bindings, hardware Vulkan compute shaders, and scientific visualization suites.
The project is released under the Apache License 2.0 to foster an open, collaborative ecosystem. Whether you are building robotics kinematics, computer graphics pipelines, quantum physics simulations, or high-throughput machine learning quantization kernels, anyone is invited to fork, experiment, submit pull requests, and contribute.
Table of Contents
- Taxonomy of Clifford Geometric Algebra Operators
- Canonical Literature & Theoretical Foundations
- Scientific Visual Gallery & Simulations
- Mathematical Foundations & Signatures
- Quickstart Guides (Rust & Python / NumPy)
- Hardware & Microarchitectural Benchmarks
- Vulkan Compute Shaders
- Community, Contributing & Forking
- Citation
- License
Taxonomy of Clifford Geometric Algebra Operators
versorc-math provides a complete, unified hierarchy of geometric operations across vector spaces and multivector grades:
| Operator Name | Canonical Symbol | Rust API | Python / NumPy API | Grade Shift ($\Delta\text{grade}$) | Mathematical Definition |
|---|---|---|---|---|---|
| Geometric Product | $A B$ | a * b, a.geometric_product(&b) |
a * b |
Mixed ($\sum \langle AB \rangle_k$) | $AB = A \cdot B + A \wedge B$ (vectors) |
| Outer / Wedge Product | $A \wedge B$ | a.wedge(&b) |
a ^ b |
Grade addition ($r + s$) | Multivector exterior product, anticommutative on 1-blades |
| Left Contraction | $A \rfloor B$ | a.left_contraction(&b) |
a | b |
Grade subtraction ($s - r, r \le s$) | Contraction dual to wedge: $(A \wedge C) \cdot B = C \cdot (A \rfloor B)$ |
| Hestenes Inner Product | $A \cdot B$ | a.hestenes_inner_product(&b) |
a.hestenes_dot(b) |
Symmetric contraction ($|r - s|$) | $\frac{1}{2}(AB + BA)$ for 1-vectors |
| Regressive / Meet Product | $A \vee B$ | a.regressive_product(&b) |
a.regressive(b) |
Intersection blade ($r + s - n$) | $A \vee B = (A* \wedge B)^{-1}$ |
| Hodge / Pseudoscalar Dual | $*A = A I^{-1}$ | a.dual(), a.undual() |
a.dual(), a.undual() |
Orthogonal complement ($n - r$) | Multiplication by inverted pseudoscalar $I^{-1}$ |
| Clifford Reversion | $A\sim$ / $A\dagger$ | a.reverse() |
~a, a.reverse() |
Sign parity: $(-1)^{k(k-1)/2}$ | Blade order reversal: $(e_{i_1}\dots e_{i_k})^\sim = e_{i_k}\dots e_{i_1}$ |
| Grade Involution | $\widehat{A}$ | a.grade_involution() |
a.involution() |
Parity sign: $(-1)^k \langle A \rangle_k$ | Main automorphism: $\widehat{u v} = \widehat{u}\widehat{v}, \widehat{v} = -v$ |
| Clifford Conjugation | $\overline{A}$ | a.conjugation() |
a.conjugation() |
Composition: $(\widehat{A})^\sim$ | Combines main involution and reversion |
| Versor Sandwich Product | $V x V^{-1}$ | v.sandwich(&x) |
v.sandwich(x) |
Grade invariant automorphism | Outermorphism action $R x R^\sim$ on arbitrary blades |
| Lie Commutator | $A \times B = \frac{1}{2}[A, B]$ | a.commutator(&b) |
a.commutator(b) |
Lie bracket on bivectors | $\frac{1}{2}(AB - BA)$, satisfies Jacobi identity |
| Anticommutator | $\frac{1}{2}{A, B}$ | a.anticommutator(&b) |
a.anticommutator(b) |
Jordan algebra generator | $\frac{1}{2}(AB + BA)$ |
| Conformal Spherical Inversion | $P' = S P S^{-1}$ | sphere.invert_in_sphere(&p) |
sphere.invert_in_sphere(p) |
Radial inversion: $r' = R^2 / r$ | 1-versor sandwich across conformal sphere |
| Möbius Gyrovector Addition | $u \oplus v$ | u.mobius_add(&v) |
u.mobius_add(v) |
Non-associative gyrovector sum | $\frac{(1 + 2\langle u,v \rangle + |v|^2)u + (1 - |u|^2)v}{1 + 2\langle u,v \rangle + |u|^2 |v|^2}$ |
| Einstein Hyperbolic Midpoint | $\mu_E(u_1..u_K)$ | PoincarePoint::einstein_midpoint(&pts, &w) |
PoincarePoint.einstein_midpoint(pts, w) |
Conformal center of mass in $B^d$ | Projective weighted mean in Beltrami-Klein $\mathbb{K}^d$ |
[!NOTE] For complete mathematical proofs, axioms, and grade shift derivations for each operator, see explanations/02_clifford_operators_and_products.md.
Canonical Literature & Theoretical Foundations
Every algorithm and operator in versorc-math is strictly grounded in established literature:
- Euclidean & Multivector Algebra ($\mathcal{Cl}{3,0}, \mathcal{Cl}{2,0}$): Hestenes & Sobczyk (1984), Doran & Lasenby (2003), Clifford (1878).
- 3D Projective Geometric Algebra ($\mathcal{Cl}^*_{3,0,1}$): Chasles (1830), Selig (2005), Dorst et al. (2007), Gunn (2019).
- 3D Conformal Geometric Algebra ($\mathcal{Cl}_{4,1}$): Dorst, Fontijne & Mann (2007), Hestenes (2001), Li et al. (2001).
- 4D Spacetime Algebra & Lounesto Spinors ($\mathcal{Cl}_{1,3}$): Lounesto (2001), Doran & Lasenby (2003), Rodrigues & Oliveira (2007).
- Gosset $E_8$ Root Lattice & Fast Decoding: Conway & Sloane (1999), Coxeter (1973), Bourbaki (1968).
- TurboQuant & Dyadic Versors: Max (1960), Lloyd (1982), Walsh (1923), Ailon & Chazelle (2006).
- Conformal Hyperbolic Geometry ($\mathbb{B}^d$): Ungar (2008), Ratcliffe (2019), Beltrami (1868), Klein (1871).
[!TIP] An exhaustive academic bibliography with detailed theorem citations and source mapping is cataloged in explanations/08_canonical_literature_and_theoretical_foundations.md.
Scientific Visual Gallery & Simulations
All visual representations below are produced directly by the engine via python3 generate_visual_plots.py:
1. 3D Projective Geometric Algebra $\mathcal{Cl}^*(3,0,1)$: SE(3) Rigid Kinematics & Chasles Screw Axis
Rigid body transformation combining rotation and translation into a single even multivector (motor $M = T R \in \text{Spin}(3,0,1)$). According to Chasles' Theorem, any spatial rigid displacement is an invariant screw motion around a unique line $L$ in space with pitch $p$. Geodesic motion is computed via continuous screw linear interpolation ($\text{ScLERP}$): $M(t) = \exp(t \log M)$.
# Motor: 180° rotation around Z with translation (2, 1, 2)
=
, , , =
# Evaluates invariant screw axis at p0 = (1.0, 0.5, 0.0) with pitch = 0.64
2. 3D Conformal Geometric Algebra $\mathcal{Cl}(4,1)$: Spherical Inversion & Circle Meet
In 3D CGA, spheres and planes are grade-1 vectors. Conformal reflection across a sphere of radius $R$ is realized through a 1-versor sandwich product $P' = S P S{-1}$, performing the classical non-Euclidean spherical inversion $|\mathbf{p}'| = R2 / |\mathbf{p}|$. The intersection of a sphere $S$ and a plane $\Pi$ yields an oriented 3-blade circle $C* = S* \wedge \Pi^*$.
=
=
= # Distance maps to R^2 / 3.6 = 1.111
# Intersection circle with horizontal cutting plane z = 0.8
=
3. 3D Euclidean Space $\mathcal{Cl}(3,0)$: 2-Blade Bivectors & Rotor Sandwich Orbits
Vectors $u, v$ span an oriented 2-blade bivector $B = u \wedge v$. Its dual $B I{-1} = *(u \wedge v)$ corresponds to the orthogonal normal vector. Rotations are generated by rotors $R(\theta) = \exp(-B \theta / 2) = \cos(\theta/2) - B_{\text{unit}} \sin(\theta/2)$ via the bilateral sandwich product $v(\theta) = R(\theta) v_0 R\sim(\theta)$.
=
=
= ^ # 2-blade parallelogram
= # Vector orthogonal to plane (+3.24 e3)
4. Gosset $E_8$ Root Lattice: 240 Minimal Roots on the Exact Coxeter Plane
The unique even unimodular lattice in 8 dimensions $E_8 = D_8 \cup (D_8 + \frac{1}{2}\mathbf{1})$ contains exactly 240 minimal root versors with norm squared $|r|^2 = 2.0$. Projecting onto the 2D Coxeter plane eigenspace of the Bourbaki Coxeter element $C = \prod_{i=1}^8 s_i$ (eigenvalue $\lambda = \exp(\pm 2\pi i / 30)$) reveals the canonical 8 concentric rings of 30 vertices with exact 30-fold dihedral symmetry $D_{30}$.
= # Shape: (240, 8) in float32
=
5. TurboQuant: Dyadic Versor Outlier Smearing & 3-Bit Lloyd-Max Quantization
Extreme activation and weight outlier channels (kurtosis $> 30$) degrade low-bit quantization in Transformer architectures. By applying a randomized Dyadic Walsh-Hadamard Versor isometry $R(W) = W H_D$, the distribution is smoothed into an isotropic Gaussian $\mathcal{N}(0, \sigma^2)$ via the Central Limit Theorem. Outliers are bounded, and weights are quantized using the 8 optimal symmetric Lloyd-Max centroids.
# Isotropic Walsh-Hadamard rotation in O(N log N) additions
=
=
= # 8 optimal N(0,1) levels
6. Conformal Hyperbolic Geometry: Poincaré Disk $\mathbb{D}^2$ (Curvature $c = -1$)
In the conformal Poincaré disk model $\mathbb{D}2$, hyperbolic points reside strictly within $|z| < 1$. Geodesics are exact circular arcs orthogonal to the ideal boundary $S1$. VersorC-Math computes exact geodesic arcs via projective correspondence with the Beltrami-Klein model $\mathbb{K}^2$, non-associative Möbius gyrovector additions $u \oplus v$, and closed-form $O(K)$ Einstein hyperbolic midpoints $\mu_E$.
=
=
= # Möbius gyrovector sum u ⊕ v
# Compute exact geodesic arc orthogonal to unit circle
=
# Exact Einstein hyperbolic center of mass
=
Mathematical Foundations & Signatures
In Clifford Geometric Algebra, vector multiplication is governed by the geometric product:
$$u v = u \cdot v + u \wedge v$$
where $u \cdot v = \frac{1}{2}(uv + vu)$ is the symmetric inner contraction and $u \wedge v = \frac{1}{2}(uv - vu)$ is the antisymmetric outer wedge product.
| Signature | Dimension | Common Name | Typical Applications |
|---|---|---|---|
| $\mathcal{Cl}(2, 0)$ | $2^2 = 4$ | Planar GA | Complex numbers ($I^2 = -1$), 2D kinematics, conformal mappings |
| $\mathcal{Cl}(3, 0)$ | $2^3 = 8$ | Spatial 3D GA | Hamilton quaternions ($\mathbb{H} \cong \mathcal{Cl}^+(3,0)$), rigid body dynamics, optics |
| $\mathcal{Cl}^*(3, 0, 1)$ | $2^4 = 16$ | 3D PGA | SE(3) robotics, screw theory, Plücker lines, dual quaternions |
| $\mathcal{Cl}(4, 1)$ | $2^5 = 32$ | 3D CGA | Conformal transformations, spheres, circles, inversions |
| $\mathcal{Cl}(1, 3)$ | $2^4 = 16$ | 4D STA | Electrodynamics, Maxwell bivectors, Dirac equation, Lounesto spinors |
| $\mathbb{R}^8 \supset E_8$ | 240 roots | Gosset Lattice | Optimal sphere packing in 8D, Conway-Sloane closest-vector decoding |
Quickstart Guides
1. Rust Integration
Add to your Cargo.toml:
[]
= "0.1.0"
# Optional features:
# versorc-math = { version = "0.1.0", features = ["vulkan", "python"] }
Basic Rust example:
use *;
2. Python / NumPy Integration
Install via pip:
Or build from source with Maturin:
Interactive Python example:
# 3D Euclidean Cl(3, 0)
, , = , ,
= ^
=
# Invertible multivector
= +
=
# Relativistic Dirac Spinor (Lounesto Class 2)
=
Hardware & Microarchitectural Benchmarks
In large Transformer projection layers ($W_{\text{gate}}, W_{\text{up}}, W_{\text{down}}$), outlier channels degrade naive low-bit quantization. versorc-math applies an isotropic Dyadic Walsh Versor rotation:
$$\mathbf{W}_{\text{rot}} = \mathbf{W} \mathbf{H}D, \quad \mathbf{x}{\text{rot}} = \mathbf{x} \mathbf{H}_D$$
Because $\mathbf{H}_D \mathbf{H}_D^T = \mathbf{I}$, inner products are strictly preserved: $\langle \mathbf{W}_i, \mathbf{x} \rangle = \langle \mathbf{W}_i \mathbf{H}_D, \mathbf{x} \mathbf{H}_D \rangle$.
Silicon Benchmark (1408 × 2048 Expert Projection Layer)
Evaluated on x86_64 AVX2 host:
| Representation | Precision | Footprint | Throughput | Speedup | Cosine vs FP32 |
|---|---|---|---|---|---|
| Dense FP32 | 32-bit | 11.00 MB | 28.4 GFLOPS | 1.00× (baseline) | 1.00000 |
| VrcAsym64 (v5) | 4.50 bpw | 1.55 MB | 54.1 GFLOPS | 1.90× | 0.99929 |
| Clifford 3-Bit (Scalar) | 4.00 bpw | 1.38 MB | 12.2 GFLOPS | 0.43× (ALU bound) | 0.99620 |
Clifford 3-Bit (AVX2 vpermps) |
4.00 bpw | 1.38 MB | 198.6 GFLOPS | 7.00× | 0.99620 |
Run benchmarks locally:
Vulkan Compute Shaders
versorc-math embeds precompiled SPIR-V 1.3+ compute shaders via include_bytes!:
pga_transform.spv: Rigid tensor point transformation $p' = M p M^\sim$ on arbitrary batches in GPU VRAM.cga_transform.spv: Conformal transformations (spherical inversions, dilations, translations).hot_stratum_e8.spv: Gosset lattice $E_8$ projection with Wave32/Wave64 subgroup optimizations.rope.spv,silu_mul.spv,rmsnorm.spv,vec_add.spv: High-performance Transformer building blocks.
Verify Vulkan integration on your GPU:
Community, Contributing & Forking
versorc-math is an open-source initiative built by and for the global scientific and engineering community. We welcome contributions from researchers, mathematicians, engineers, educators, and students of all backgrounds!
- Contributing Guide: Check out CONTRIBUTING.md for full setup instructions, development workflow, and testing guides.
- Code of Conduct: We are committed to fostering a welcoming, harassment-free environment for everyone. Please review our Code of Conduct.
- Good First Issues: Whether fixing a typo in theoretical proofs, adding a test case, or optimizing a kernel, all pull requests are valued and reviewed with care.
How You Can Contribute:
- New Geometric Algebras: Implement $\mathcal{Cl}(0, 2)$, Conformal 2D, or Compass Geometric Algebra signatures.
- Hardware SIMD Kernels: Contribute ARM NEON, AVX-512, or WebAssembly SIMD128 implementations.
- Python / Framework Integrations: Build PyTorch, JAX, or Taichi bindings for Clifford tensor operations.
- Documentation & Educational Visualizations: Enhance derivations, Jupyter notebooks, or GanJa.js interactive scenes.
Contribution Workflow:
- Fork the Repository: Click "Fork" on GitHub.
- Create a Feature Branch:
- Ensure All Tests Pass:
- Submit a Pull Request: Open a PR describing your mathematical rationale and test coverage. Our maintainers will gladly assist with reviews!
Citation
If you utilize versorc-math in your research, academic publications, or open-source software, please cite:
License
Licensed under the Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.