Skip to main content

LPFN

Lie-Product Function Networks for geometry-preserving matrix Lie-group learning.

LPFN is a PyTorch research library for learning functions whose outputs must remain in a compact matrix Lie group. The library separates two concerns:

  1. scalar controls x -> theta(x), represented by interchangeable ControlModel classes; and
  2. Lie-group execution, represented by an ExecutionEngine that composes ordered exponentials of fixed generators.

For controls theta with shape [batch, K, r], LPFN implements the convention

U(x) = Q_M ... Q_2 Q_1 U_0,
Q_ell = exp(theta_ell B_ell),

where factors are flattened in increasing (k, a) order, so Q_1 acts first. The matrix output stays on the target group by construction.

Status: 0.1.0 is a public research release. The core semantics are tested, but the API may still evolve before 1.0.

Install

pip install liepfn

Development install:

python -m pip install -e ".[dev]"
pytest

Minimal example

import torch
from lpfn import (
    ChebyshevControls,
    LieProductNetwork,
    PauliGeneratorSet,
    PauliMatrixEngine,
)

generators = PauliGeneratorSet(1)
controls = ChebyshevControls(
    input_dim=1,
    depth=2,
    num_generators=generators.num_generators,
    degree=3,
)
model = LieProductNetwork(
    generators=generators,
    controls=controls,
    engine=PauliMatrixEngine(),
)

x = torch.linspace(-1, 1, 32, dtype=torch.float64).reshape(-1, 1)
U = model(x)  # [32, 2, 2]

Changing ChebyshevControls to a spline, Fourier, MLP, or other control model does not change the Lie geometry. Changing the matrix execution engine does not change the scalar model.

Included control models

  • DirectControls — exact/reference controls.
  • ChebyshevControls — total-degree multivariate Chebyshev expansions.
  • FourierControls — real multivariate trigonometric bases with mixed modes.
  • SplineControls — tensor-product open-uniform B-splines.
  • MLPControls — generic neural controls.
  • KANControls — experimental KAN-style B-spline edge controls.

Execution engines

  • TorchMatrixEngine — differentiable reference engine based on matrix exponentials.
  • PauliMatrixEngine — optimized Pauli path using cos(theta) I - i sin(theta) P.

What is tested

The test suite covers:

  • generator validation and Pauli algebra;
  • noncommutative factor ordering and base-point semantics;
  • exact group/unitarity preservation;
  • cross-engine numerical agreement;
  • analytical, autograd, and finite-difference derivative checks;
  • scalar-control shape/parameter contracts;
  • losses and metrics;
  • target/data utilities;
  • end-to-end training;
  • reproducible benchmark and validation-selection logic.

Documentation

The source repository includes:

  • docs/QUICKSTART.md — quick start;
  • docs/PUBLIC_API.md — supported research API;
  • docs/CONVENTIONS.md — mathematical conventions and ordering;
  • docs/REPRODUCIBILITY.md — benchmark/reproducibility protocol;
  • docs/KAN_CONTROLS.md — experimental KAN controls;
  • CONTRIBUTING.md — development guidance;
  • CHANGELOG.md — release history.

Research benchmarks

Research scripts are kept in benchmarks/, outside the installed package. Generated checkpoints and result tables are intentionally excluded from the release repository. This prevents benchmark artifacts from becoming part of the runtime dependency or wheel.

Citation

If you use LPFN in research, please cite the software and the associated Lie-Product Function Networks on Compact Matrix Lie Groups manuscript. A machine-readable software citation is provided in CITATION.cff.

License

LPFN is released under the MIT License. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

liepfn-0.1.0.tar.gz (63.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liepfn-0.1.0-py3-none-any.whl (51.7 kB view details)

Uploaded Python 3

File details

Details for the file liepfn-0.1.0.tar.gz.

File metadata

  • Download URL: liepfn-0.1.0.tar.gz
  • Upload date:
  • Size: 63.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for liepfn-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bb9222391174de63c7734e7dbbbc708033a0bb163e304ef11fdf00491cf1e6a4
MD5 049522d1c80743a6867c62bfa842159f
BLAKE2b-256 1d83b0b993904b9dd03bda1cbd27e53bbdc99a87646c8288def7a2d5d6f02f88

See more details on using hashes here.

Provenance

The following attestation bundles were made for liepfn-0.1.0.tar.gz:

Publisher: release.yml on anfriosmo/lpfn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file liepfn-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: liepfn-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 51.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for liepfn-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9afa25560830412fbd8ddc57b59f27e9269592c048bf5fb4431594668e7fa697
MD5 70d4ce04aa3e64fcd9fcee8d1fada717
BLAKE2b-256 ecc82d7c8f04e8b676099b7b302028c0d6607d676c82a3c9ba235a4b840ac3ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for liepfn-0.1.0-py3-none-any.whl:

Publisher: release.yml on anfriosmo/lpfn

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 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