Skip to main content

Yuzuha SU(2) Protocol

PyPI Version License Documentation Python ≥ 3.11 Rust Coverage Status

Yuzuha is a high-performance library for computing SU(2) recoupling coefficients in tensor network applications, providing efficient implementations of X-symbols (recoupling coefficients for arbitrary tensor network contractions) and R-symbols (axes permutation). The library features automatic database caching for computed canonical bases, enabling significant performance improvements for repeated calculations. Available for both Rust and Python, and optimized as the recoupling engine for the Nicole tensor library.

Features

  • X-symbols: Complete computation for arbitrary tensor network contractions
  • R-symbols: Tensor axis permutation transformations
  • Clebsch-Gordan (CG) coefficients: Real-valued Condon-Shortley convention with automatic caching
  • Invariant metric: Full support for arbitrary arrow directions via metric tensor
  • Outer multiplicity (OM) enumeration: Systematic enumeration of internal spin configurations
  • CG database: SQLite database for CG bases with automatic connection management
  • Python bindings: High-performance Python interface with NumPy integration
  • Type safety: Extensive use of Rust's type system for correctness
  • Comprehensive tests: >95% code coverage with unit and integration tests

Database Caching

Yuzuha automatically caches computed canonical basis data in an SQLite database for significant performance improvements on repeated calculations.

  • Persistent storage: Cached data survives between program runs
  • Thread-safe: Automatic connection management with mutex protection
  • Automatic: No explicit connection management needed
  • Efficient: Subsequent computations with same spin configurations are near-instantaneous

Conventions

Clebsch-Gordan Coefficients

Yuzuha uses the Condon-Shortley convention for Clebsch-Gordan (CG) coefficients, which describe the coupling of two angular momentum states:

$$C^{j_3 m_3}_{j_1 m_1, j_2 m_2} \equiv \langle j_1 m_1, j_2 m_2 | j_3 m_3 \rangle$$

These coefficients satisfy several important properties:

  • Real-valued: All CG coefficients are real numbers in the Condon-Shortley convention
  • Orthonormality: The coefficients form an orthonormal basis: $$\sum_{m_1, m_2} \langle j_1 m_1, j_2 m_2 | j_3 m_3 \rangle^2 = 1$$
  • Selection rules: Non-zero coefficients require:
    • Magnetic quantum number conservation: $m_1 + m_2 = m_3$
    • Triangle inequality: $|j_1 - j_2| \leqslant j_3 \leqslant j_1 + j_2$
    • Integer total spin: $j_1 + j_2 + j_3 \in \mathbb{Z}$

The library automatically caches computed CG coefficients in an SQLite database for efficient reuse across calculations.

Arrow Directions and the Invariant Metric

In tensor network diagrams, tensor edges can point either inward (incoming) or outward (outgoing), corresponding to primal and dual spaces, respectively. The invariant metric $g$ implements arrow reversal transformations:

$$g^{(j)}{m,m'} = (-1)^{j-m} \delta{m,-m'}$$

This metric tensor allows seamless conversion between incoming and outgoing edges while maintaining the correct sign conventions. Arrow inversion from incoming to outgoing uses the metric tensor $g$, while inversion from outgoing to incoming uses the inverse transformation $g^{-1}$.

Fusion Trees

Yuzuha represents tensor network contractions using left-associative fusion trees, which provide a systematic way to couple multiple angular momenta:

  • Left-associative structure: For $n$ spins, the coupling proceeds sequentially from left to right: $$(((j_1 \otimes j_2) \otimes j_3) \otimes \cdots) \otimes j_n$$

  • Internal spins ($\alpha$): Each intermediate fusion step produces an internal spin quantum number. For $n$ external edges, there are $n-2$ internal spins that characterize the coupling path.

  • Outer Multiplicity (OM) index ($\mu$): When multiple internal spin configurations (fusion patterns) lead to the same total coupling, they are distinguished by the OM index placed at the end of the canonical bases.

  • CG bases normalization: The canonical basis is normalized with respect to the OM space. As a result, 3rd order CG bases acquire a scaling factor relative to the standard CG coefficients.

The left-associative structure ensures a unique canonical form for each tensor network, enabling efficient computation and caching of recoupling coefficients.

Contributing

We welcome contributions from the community! Whether you're fixing bugs, adding features, improving algorithms, or enhancing documentation, your help is appreciated. You can also contribute by requesting new features or reporting performance issues.

Yuzuha is created and maintained by Changkai Zhang as part of the Ideogenesis-AI effort in studying quantum many-body systems. If you have questions about contributing to the project or are interested in collaboration opportunities, please feel free to open an issue on GitHub or contact the maintainer directly.

License

Yuzuha is licensed under the GNU General Public License v3.0 (GPL-3.0). This means you are free to use, modify, and distribute this software under the terms of the GPL-3.0 license. We encourage you to share any improvements you make back to the community, helping Yuzuha grow and benefit all users. See the LICENSE file for the full license text. For more information about GPL-3.0, visit https://www.gnu.org/licenses/gpl-3.0.html

Metadata

Release files for yuzuha 0.2.0

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

Source distribution (sdist)

Source distribution for yuzuha 0.2.0
File Size Uploaded Provenance Actions
yuzuha-0.2.0.tar.gz 4.6 MB Without provenance Details for yuzuha-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for yuzuha 0.2.0
File Actions
yuzuha-0.2.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for yuzuha-0.2.0-cp311-abi3-win_amd64.whl
yuzuha-0.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 abi3 Linux glibc 2.17+ x86-64 Details for yuzuha-0.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
yuzuha-0.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.11 abi3 Linux glibc 2.17+ ARM64 Details for yuzuha-0.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
yuzuha-0.2.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for yuzuha-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
yuzuha-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for yuzuha-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 12.3 MB

Release files / yuzuha-0.2.0.tar.gz

Download URL yuzuha-0.2.0.tar.gz
Size 4.6 MB
Tags Source
SHA-256 checksum
How to use checksums
6821e14e5025e1616b911140eab7802ab5f42d4a3db1b557327f8621c4b60356
BLAKE2b-256 checksum
How to use checksums
7312e814c1cee16b20a83965fa0ee954ea380cf11d4e59a13e003d51f8615340
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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 / yuzuha-0.2.0-cp311-abi3-win_amd64.whl

Download URL yuzuha-0.2.0-cp311-abi3-win_amd64.whl
Size 1.4 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8da6b5b58176fe74ee12a8882d4d7fd494096ce68339d8fb90ca255aa9785bfc
BLAKE2b-256 checksum
How to use checksums
f0341562df079b6bbf52bf8ef1e43ae5d527dd8193250ae46adb678a5b48b2c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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 / yuzuha-0.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL yuzuha-0.2.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 1.7 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
eb7a1073f33edd0dc46355fd9feb473733135cc523eb7248f831f9036f6b7503
BLAKE2b-256 checksum
How to use checksums
b80ba29fa1010ff441e2ebef2fa0ae9166bfb5e923a35f2082d5d34ed3d9ce2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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 / yuzuha-0.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL yuzuha-0.2.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 1.5 MB
Tags CPython 3.11 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
88e7a807d4ab3dce28b862d5ed7f9c813eeb4b46567fbf3697d10e8d406a9d48
BLAKE2b-256 checksum
How to use checksums
6c9fc8664d1f6ca3ef30ebce7dffa8e1be8d6d5b177ac16a2d6485e64fcde923
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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 / yuzuha-0.2.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL yuzuha-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
Size 1.5 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
f671ed9149c579762c6efa697876567473dcf31d898194a09c5ba215698aa40b
BLAKE2b-256 checksum
How to use checksums
9191626be91428644266ac954d329e703e90da35c8b43b5a636e52310d08119d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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 / yuzuha-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL yuzuha-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 1.6 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
eb7ac584a09ef72e8d586acb2b85bfdc9a13b1f579617b945c7eee8964c855f3
BLAKE2b-256 checksum
How to use checksums
8a79c2080d11b302f0f5ef0119b6fbfb10c55daca6fd1f1cc12e3248a6d581db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","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}

Security for yuzuha 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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