Table of Contents
Fetching ...

The Willing Kingdon Clifford Algebra Library

Martin Roelfs

TL;DR

Kingdon introduces a Python Geometric Algebra library that is input-type-agnostic, enabling GA computations on PyTorch tensors, NumPy arrays, and SymPy expressions without changing code, while using symbolic optimization and input sparsity to produce efficient JIT expressions and ganja.js-based visualization in notebooks. At its core, Kingdon represents multivectors as sparse, dictionary-like structures keyed by binary basis blades, and lazily compiles operator implementations on first use, leveraging Common Subexpression Elimination to reduce repetitive computation. Performance results indicate fast initial code generation with substantial speedups on subsequent runs, particularly when exploiting sparsity and broadcasting across array-based multivectors. The paper also outlines adoption-friendly design choices, including an MIT license, ecosystem alignment with GAmphetamine.js, and practical demonstrations (e.g., boids, mechanism differentiation) that point toward differentiable GA workflows and GA-based neural network extensions.

Abstract

Kingdon is an open-source Python package designed to seamlessly integrate Geometric Algebra (GA) into existing workflows. Unlike previous GA libraries, kingdon is input-type-agnostic, and hence supports GA's over e.g. PyTorch tensors, NumPy arrays, or SymPy symbolic expressions, to name but a few. Despite this refusal to specialize, it delivers high performance by symbolically optimizing operators and leveraging input sparsity for Just-In-Time compiled expressions. Additionally, its visualization capabilities in Jupyter notebooks using ganja align with the rapid prototyping workflow common to scientific research.

The Willing Kingdon Clifford Algebra Library

TL;DR

Kingdon introduces a Python Geometric Algebra library that is input-type-agnostic, enabling GA computations on PyTorch tensors, NumPy arrays, and SymPy expressions without changing code, while using symbolic optimization and input sparsity to produce efficient JIT expressions and ganja.js-based visualization in notebooks. At its core, Kingdon represents multivectors as sparse, dictionary-like structures keyed by binary basis blades, and lazily compiles operator implementations on first use, leveraging Common Subexpression Elimination to reduce repetitive computation. Performance results indicate fast initial code generation with substantial speedups on subsequent runs, particularly when exploiting sparsity and broadcasting across array-based multivectors. The paper also outlines adoption-friendly design choices, including an MIT license, ecosystem alignment with GAmphetamine.js, and practical demonstrations (e.g., boids, mechanism differentiation) that point toward differentiable GA workflows and GA-based neural network extensions.

Abstract

Kingdon is an open-source Python package designed to seamlessly integrate Geometric Algebra (GA) into existing workflows. Unlike previous GA libraries, kingdon is input-type-agnostic, and hence supports GA's over e.g. PyTorch tensors, NumPy arrays, or SymPy symbolic expressions, to name but a few. Despite this refusal to specialize, it delivers high performance by symbolically optimizing operators and leveraging input sparsity for Just-In-Time compiled expressions. Additionally, its visualization capabilities in Jupyter notebooks using ganja align with the rapid prototyping workflow common to scientific research.

Paper Structure

This paper contains 4 sections, 1 figure, 2 tables.

Figures (1)

  • Figure 1: Diagramatic representation of the steps taken by kingdon when performing operators between/on multivectors.