Skip to main content

clifra

License Python PyTorch Docs DOI

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

Please check documentation milestone and status

The docs are intentionally small: API pages come from live docstrings, and docs/core-design.md keeps the process snippets.

See docs/first-guide.md, If you are a little confused or think you need an intuitive understanding, please refer to the first guide and move on to the docs/core-design.md or docs/api/.

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.

The strict PGA metamaterial example in research/continuum_solver/examples/metamaterial_design.py demonstrates a difficult auxetic-to-positive phase target with reversible deformation paths. The recorded validation run reached the target loss (0.001632 < 0.01) with no validation failures, zero folded cells, and extremely small inverse-path error (inverse_rmse=4.10e-16, inverse_max_abs=2.00e-15), producing VTK/GIF artifacts under outputs/metamaterial_design/.

Contribution

Found a problem or want to propose a change? Please open an Issue first, especially before a PR, so the scope is clear.

For direct contact, email: nemonanconcode@gmail.com

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.1},
  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.py are 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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clifra 1.1.1
File Size Uploaded
clifra-1.1.1.tar.gz 154.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clifra 1.1.1
File Interpreter ABI Platform
clifra-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 347.7 kB

Release files / clifra-1.1.1.tar.gz

Download URL clifra-1.1.1.tar.gz
Size 154.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3831117a1c71e94384a88bacb9109dd110c7b6bbc61c47f886759da5b0277ba6
BLAKE2b-256 checksum
How to use checksums
8501355098a5edaf71904384c0524f31fb4ea9dc53091bfcb3655e10c561c9a3
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.1-py3-none-any.whl

Download URL clifra-1.1.1-py3-none-any.whl
Size 193.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87a51fabca53a22ca16b3f9410e9c8b553b2015bcf19ccd82b262367719addf6
BLAKE2b-256 checksum
How to use checksums
358fe1d36dce3ae6ca3b38eccc0f12ca015cc28c1a2c3f5d739a74da2d2edce0
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 history Release notifications | RSS feed

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page