Skip to main content

clifra

License Python PyTorch Docs DOI

Layout-first Clifford algebra tools for PyTorch.

A clifra algebra host owns its layouts, policies, and operation plans. Full-lane tensors and compact grade layouts share that algebra, while planning builds static executors for products, metrics, exponentials, and actions. Layers and other library components reuse the same operations.

Install

uv sync

Development:

uv sync --group 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 --group dev pytest tests/ -n12 -q --tb=short
uv run --group dev pytest tests/ --hypothesis-profile=full -n12 -q --tb=short
uv run --group dev ruff check .
uv run --group docs mkdocs build

See the documentation for tutorials, explanations, benchmarks, and the generated API reference.

Research Showcase: Clifford Transformation Fields

research/continuum_solver is Clifra's clearest end-to-end demonstration of layout-directed geometric learning. It turns sampled bivector generators into differentiable fields of local Clifford actions. Coordinate values and persistent sample labels remain distinct, while samplers, action paths, and differentiable objectives are independently configurable.

Bivector field basics is the compact introduction. It learns a coordinate-dependent action on unordered points and demonstrates metric preservation, labeled inversion, and permutation equivariance.

uv run research/continuum_solver/examples/bivector_field_basics.py

Physics-informed deformation design drives the same transformation-field mechanism with material mechanics, boundary conditions, guarded optimization, strict validation, and visualization. It demonstrates a complete scientific system built from the general field construction.

uv run --group viz research/continuum_solver/examples/physics_informed_deformation_design.py

Clifra compiles declared geometric coordinates into differentiable actions. The continuum solver assembles those actions into trainable fields, and applications decide what those fields learn through their objectives and constraints.

See Why bivector coordinate fields work for the derivation, field semantics, and inversion model.

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.3.1},
  year    = {2026},
  doi     = {10.5281/zenodo.18939518},
  license = {Apache-2.0}
}

References

These works provide conceptual background for RotorGadget and the tag-aware optimizers. Clifra's behavior is defined by its public API, source, and tests.

RotorGadget Background

  • Pence, T., Yamada, D., & Singh, V. (2025). "Composing Linear Layers from Irreducibles." arXiv:2507.11688.

Optimization Background

The tag-aware optimizers in clifra/optimizers/ dispatch spin, sphere, and euclidean post-update handling.

  • 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.3.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.3.1
File Size Uploaded
clifra-1.3.1.tar.gz 157.7 kB Details

Built distribution (wheel)

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

Total release size: 356.3 kB

Release files / clifra-1.3.1.tar.gz

Download URL clifra-1.3.1.tar.gz
Size 157.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8ca3da86e4b1a8594271116fc28fe6c0d8939d60243f7590cf765b5322a0685c
BLAKE2b-256 checksum
How to use checksums
2acd2f67ec928d1685b0442f28c0ae854f5a648125a3edaba5a3e5968fb00cf9
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.3.1-py3-none-any.whl

Download URL clifra-1.3.1-py3-none-any.whl
Size 198.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a61ec3e4996a60e0f1a3b60ae729f8dfdead116b422ebcd0ed1a9880152335d9
BLAKE2b-256 checksum
How to use checksums
ce2563e2b6f864f6df7e7dedb8688b2562b453918d4dee81354d9b5c48ca8cc3
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

This release

1.3.1 This release

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

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