clifra
Layout-first Clifford algebra tools for PyTorch.
Clifra exposes one planner-owned algebra host. Full-lane tensors and compact grade layouts share the same algebra, while planning builds static executors for products, metrics, exponentials, actions, layers, and analysis utilities.
Install
uv sync
uv sync --extra dev
Docs:
uv sync --group docs
uv run --group docs mkdocs serve
Minimal Use
import torch
from clifra import make_algebra
algebra = make_algebra(3, 0, device="cpu")
vectors = algebra.layout((1,))
products = algebra.plan_product(
op="gp",
left_layout=vectors,
right_layout=vectors,
output_layout=algebra.layout((0, 2)),
)
left = torch.randn(8, vectors.dim)
right = torch.randn(8, vectors.dim)
out = products(left, right)
Checks
uv run pytest tests/ -m unit -q --tb=short
uv run pytest tests/ -m "not slow" -q --tb=short
uv run ruff check .
uv run --group docs mkdocs build
Docs
The docs are intentionally small: API pages come from live docstrings, and
docs/core-design.md keeps the process snippets.
Research
research/continuum_solver is a research engine built on clifra for fitting
stable, fast continuum deformations. It uses diffeomorphism-style coordinate
morphing over clifra charts and invertible bivector fields, inheriting clifra's
planned algebra execution.
Contribution
Found a problem or want to propose a change? Please open an Issue first, especially before a PR, so the scope is clear.
License
Apache License 2.0. See LICENSE and NOTICE.
Citation
@software{kim2026clifra,
author = {Kim, Eunkyum},
title = {clifra: Clifford Algebra Layers for PyTorch},
url = {https://github.com/Concode0/clifra},
version = {1.1.0},
year = {2026},
doi = {10.5281/zenodo.18939518},
license = {Apache-2.0}
}
References
RotorGadget Layer Architectures
This project implements the equivariant layer architectures derived from the irreducible decomposition of Clifford multivectors.
- RotorGadget implementations found in
clifra/layers/primitives/rotor_gadget.pyare based on:- Pence, T., Yamada, D., & Singh, V. (2025). "Composing Linear Layers from Irreducibles." arXiv:2507.11688.
Optimization on Manifolds
The core solvers and adaptive optimizers in clifra/optimizers/ leverage Riemannian optimization techniques to handle the non-linear constraints of multivector rotors and versor transformations:
- Absil, P.-A., Mahony, R., & Sepulchre, R. (2008). Optimization Algorithms on Matrix Manifolds. Princeton University Press.
- Boumal, N. (2023). An Introduction to Optimization on Smooth Manifolds. Cambridge University Press.
Metadata
Release files for clifra 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| clifra-1.1.0.tar.gz | 468.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| clifra-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 867.5 kB
Release files / clifra-1.1.0.tar.gz
| Download URL | clifra-1.1.0.tar.gz |
|---|---|
| Size | 468.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cdf054cf8d68d02cad4738d846a53863226fbc0679e25da7cdc523c44a32b7ea
|
|
BLAKE2b-256 checksum How to use checksums |
d60b3df1d5731f81faf5aff428322fabbe801953cb73e99f05b3486b79cdd502
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / clifra-1.1.0-py3-none-any.whl
| Download URL | clifra-1.1.0-py3-none-any.whl |
|---|---|
| Size | 399.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
90290e76639599c89b9e0998b66c43c5d1e3161a3b11bad5aef236656d92ece4
|
|
BLAKE2b-256 checksum How to use checksums |
3b841dd00b2f3055437425a64c0305b7208b7c5d9685fe6bbcd0381a92cbfa9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|