Skip to main content
symmray logo

Tests Code Coverage Docs PyPI Anaconda-Server Badge Pixi Badge

symmray provides block-sparse arrays with abelian symmetries and fermionic signs. Its arrays follow the NumPy interface where possible and can store blocks using NumPy, PyTorch, JAX, or another autoray backend.

Key features include:

  • sparse and flat storage layouts
  • Z2, U1, Z2Z2, U1U1, and finite cyclic symmetries
  • local fermionic phase handling for arbitrary tensor-network geometries
  • contraction, fusion, reshaping, and blockwise linear algebra
  • tensor-network and Hamiltonian constructors for quimb
import symmray as sr

# some U(1) indices
a, b, c, d, e = [
    sr.utils.rand_index("U1", size, dual=False, seed=seed)
    for seed, size in enumerate((4, 6, 8, 5, 7))
]

# some fermionic arrays
X = sr.utils.get_rand(
    "U1",
    shape=(a, b, c.conj()),
    fermionic=True,
    seed=6,
)
Y = sr.utils.get_rand(
    "U1",
    shape=(c, d.conj(), e.conj()),
    fermionic=True,
    seed=7,
)

# contract them
Z = sr.einsum("abc,cde->abde", X, Y)

# fuse into a matrix
matrix = Z.reshape((4 * 6, 5 * 7))

# decompose
U, s, VH = sr.linalg.svd(matrix)
print(U)
# U1FermionicArray(ndim=2, charge=0, indices=[
#     (24 = 2+4+6+6+4+2 : +[-2,-1,0,1,2,3])
#         -2 ; (2) : [(-1, -1)]
#         -1 ; (2+2) : [(-1, 0),(0, -1)]
#         0 ; (2+2+2) : [(-1, 1),(0, 0),(1, -1)]
#         1 ; (2+2+2) : [(0, 1),(1, 0),(2, -1)]
#         2 ; (2+2) : [(1, 1),(2, 0)]
#         3 ; (2) : [(2, 1)]
#     (23 = 2+4+5+6+4+2 : -[-2,-1,0,1,2,3])
# ], num_blocks=6, backend=numpy, dtype=float64)

See the documentation for installation, guides, examples, and the API reference. Contributions are welcome; see the development guide and GitHub issues.

Download files

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

Source Distribution

symmray-0.3.0.tar.gz (704.5 kB view details)

Uploaded Source

Built Distribution

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

symmray-0.3.0-py3-none-any.whl (138.2 kB view details)

Uploaded Python 3

File details

Details for the file symmray-0.3.0.tar.gz.

File metadata

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

File hashes

Hashes for symmray-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3a479d12f95b5e724e8955aa45cb2c2e7808b38a039455c8b3241369885db7fd
MD5 2ba13b8df38a7e2d19cc73d4a78d6e40
BLAKE2b-256 90d81142e180b1fbfc6da598a04d9b72b75bc76a417ca4edd438dd480a0f6a17

See more details on using hashes here.

Provenance

The following attestation bundles were made for symmray-0.3.0.tar.gz:

Publisher: pypi-release.yml on jcmgray/symmray

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

File details

Details for the file symmray-0.3.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for symmray-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b93ead54e439238033e8632a63a2fa023f807ce4ec0111fc5f080935231dcda
MD5 afeff4957ec45c00a4b9bab7747d6860
BLAKE2b-256 2c9b7a28db3609f251fbcbf73abd0b98a5703619aa0b141b2ec23195cad4903a

See more details on using hashes here.

Provenance

The following attestation bundles were made for symmray-0.3.0-py3-none-any.whl:

Publisher: pypi-release.yml on jcmgray/symmray

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.3.0 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page