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
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

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.2.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.2.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.2.1
File Size Uploaded
clifra-1.2.1.tar.gz 154.9 kB Details

Built distribution (wheel)

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

Total release size: 348.5 kB

Release files / clifra-1.2.1.tar.gz

Download URL clifra-1.2.1.tar.gz
Size 154.9 kB
Tags Source
SHA-256 checksum
How to use checksums
469a7be9edc4b1ed84c37c3c61be22ab51f721227fd058a85f747a2808a54da6
BLAKE2b-256 checksum
How to use checksums
65d30d63b7afe639d0693092b274a94ac79baa303ce2b7e5952ccfa10af62343
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.2.1-py3-none-any.whl

Download URL clifra-1.2.1-py3-none-any.whl
Size 193.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
606c03fd5e213e147a9b77230265f29c6cb1b44c618b6bd5307f4577c900cb00
BLAKE2b-256 checksum
How to use checksums
011309199a4f5badc6026efaa9d04072c8c359ceb8de79079706df95da1d7f58
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

This release

1.2.1 This release

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