Yuzuha: SU(2) Protocol for Tensor Networks
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yuzuha-0.1.4.tar.gz.
File metadata
- Download URL: yuzuha-0.1.4.tar.gz
- Upload date:
- Size: 4.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7b6b50a9e5e351048d1f3949305bad922e4af0abb358cea1c5d8b9a677370b7
|
|
| MD5 |
46a193acbf803eb8a059ea92d5697a1c
|
|
| BLAKE2b-256 |
076540de0242e2cdc6657b8f769888ce2cedb3695aac47e31d524ea328b5cd19
|
File details
Details for the file yuzuha-0.1.4-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: yuzuha-0.1.4-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dbb20f515d9febf5202089096689e3340d678e5303cf25af30d65ed3c653c4b
|
|
| MD5 |
b150d2ec080fcfee111d434cb4e3087b
|
|
| BLAKE2b-256 |
9d215844bdf9599106846d019a1dc30761a0bf48826c282180cbda0dd63361e3
|
File details
Details for the file yuzuha-0.1.4-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: yuzuha-0.1.4-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fac6220471d295c4728805372ae801f9ae9be96a9a2b9f98315ae0213c61c7e9
|
|
| MD5 |
853b99377df18f18c2a6030cce2fd354
|
|
| BLAKE2b-256 |
14daee7e05351753368138146d951f5effbf1474d45b23a0454f97b4061db1f9
|
File details
Details for the file yuzuha-0.1.4-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: yuzuha-0.1.4-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
028f55d7d12c0fa52045c885d3ec3d6b4e95d8e3da9d37271ff276a3aed21f8c
|
|
| MD5 |
e288a9eb21248b6607438ee5e7c4decc
|
|
| BLAKE2b-256 |
a18816f9cd321073878f47461490f6316b0bd99c6f69814425c3fa39785b5411
|
File details
Details for the file yuzuha-0.1.4-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: yuzuha-0.1.4-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6397b6932baef47c9083e4077d268e19326d0627be55dece9ea8d5f46c2aa67a
|
|
| MD5 |
4ce562007acb79500721a99c662413e6
|
|
| BLAKE2b-256 |
e810c3cd117a19a9a27ea7346f8b287a45db60fad8a7c6a443b38c128048d5d6
|
File details
Details for the file yuzuha-0.1.4-cp311-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: yuzuha-0.1.4-cp311-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.11+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd68345a04d5faefe652835d66b732c9271766cdc00dd425e59b07ed6c3554d8
|
|
| MD5 |
ca370633cca5df21774f08bd402ecf3e
|
|
| BLAKE2b-256 |
5ab329ccdfdcbf2c0c20624416e8d309d41e629d67af0f3f6f3bde9b367135e3
|