schur-weyl
Tools from Schur–Weyl duality, built from scratch on top of numpy and the Python standard library — no representation-theory or combinatorics dependencies.
Schur–Weyl duality decomposes $(\mathbb{C}^d)^{\otimes n}$ under the commuting actions of $S_n$ (permuting tensor factors) and $GL_d$ (acting diagonally) into isotypic blocks indexed by partitions $\lambda \vdash n$ with $\ell(\lambda) \le d$:
$$(\mathbb{C}^d)^{\otimes n} \cong \bigoplus_{\lambda} S^\lambda \otimes V_\lambda^d$$
This package implements the combinatorics and linear algebra needed to work with that decomposition directly: partitions and Young tableaux, dimension formulas, symmetric-group characters via Murnaghan–Nakayama, Schur polynomials, isotypic projectors on tensor space, the Schur–Weyl measure, and Young's orthogonal form for the irreducible representations of $S_n$.
Every module is checked against an exact mathematical identity in the test suite (Burnside's identity, character orthogonality, projector idempotence, unitarity of Young's orthogonal form, the Jucys–Murphy diagonalization, ...) rather than against hand-computed examples alone. See .selfDoc/schur_weyl_roadmap.md for the full design roadmap and the identities each phase is gated on.
Installation
Requires Python ≥ 3.9.
pip install schur-weyl
The package itself only depends on numpy. For local development (cloning the repo, running the test suite), install it editable with the dev extra instead, which pulls in pytest and ruff:
pip install -e ".[dev]"
Modules
| Module | Contents |
|---|---|
young_diagrams |
Partitions, conjugation, hook lengths, content, dominance order, addable/removable corners |
dimensions |
$f^\lambda$ (Specht module dimension, hook-length formula) and $\dim V_\lambda^d$ (Weyl module dimension, content formula) |
tableaux |
Standard and semistandard Young tableaux, Kostka numbers, reading words |
symmetric_group |
Permutations as 0-indexed one-line tuples: composition, inverse, cycle type, conjugacy class sizes |
character |
Irreducible characters $\chi^\lambda(\mu)$ of $S_n$ via the Murnaghan–Nakayama rule; full character tables |
symmetric_functions |
Schur polynomials (Jacobi–Trudi) and power-sum symmetric functions |
isotypic |
Isotypic projectors $P_\lambda$ acting on $(\mathbb{C}^d)^{\otimes n}$, built from class sums of the permutation action |
sw_measure |
The Schur–Weyl measure $\Pr[\lambda] = f^\lambda, s_\lambda(\mathrm{spec},\rho)$ for i.i.d. copies of a state $\rho$ |
young_orthonormal |
Young's orthogonal form: explicit irrep matrices $\rho^\lambda(\sigma)$ indexed by standard tableaux, and the Jucys–Murphy elements |
Usage
from schur_weyl import (
partitions, dim_specht, dim_weyl, kostka,
schur_polynomial, isotypic_proj,
)
from schur_weyl.character import character, character_table
from schur_weyl.sw_measure import schur_weyl_measure
# dimension formulas
dim_specht((2, 1)) # -> 2, the standard rep of S_3
dim_weyl((2, 1), d=3) # -> 8
# characters via Murnaghan-Nakayama
character((2, 1), (3,)) # -> -1
# the Schur-Weyl measure for n i.i.d. copies of a state with given spectrum
schur_weyl_measure(spectrum=[0.7, 0.3], k=4)
# -> {(4,): 0.4141, (3, 1): 0.4977, (2, 2): 0.0882, (2, 1, 1): 0.0, (1, 1, 1, 1): 0.0}
# the isotypic projector on (C^d)^{\otimes n}
P = isotypic_proj((2, 1), d=2) # np.ndarray, P @ P == P
Testing
pytest
Tests live in tests/ and mirror the module layout; most assert the closed-form identities from the roadmap (e.g. $\sum_\lambda (f^\lambda)^2 = n!$, character-table orthogonality, $P_\lambda^2 = P_\lambda$, $\operatorname{tr}\rho^\lambda(X_k)$ diagonal with content eigenvalues) rather than fixed expected outputs.
Status
Implemented through Young's orthogonal form and Jucys–Murphy elements (roadmap phases 0–5, 7–9). Not yet implemented: the generic tensor-space permutation action as a standalone module (phase 6, currently inlined in isotypic), and the explicit Schur transform (phase 10). See TODO.md for near-term items.
License
MIT — see LICENSE.
Metadata
Release files for schur-weyl 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| schur_weyl-0.1.1.tar.gz | 15.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| schur_weyl-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.8 kB
Release files / schur_weyl-0.1.1.tar.gz
| Download URL | schur_weyl-0.1.1.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
636e53c6ed5a2d561cdaeb88b8a5269c7bf0f7f0f24dfdd0801a2c07a18047ba
|
|
BLAKE2b-256 checksum How to use checksums |
fff6bcd21fbdccc222d8c7ee03693af38ecd4284e56236153c7b3c99cdaf8c15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 29, 2026.
Transparency logRelease files / schur_weyl-0.1.1-py3-none-any.whl
| Download URL | schur_weyl-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f3122d22d40b23ac5e1f310d5a97435bd6ea6ded17566de8861a124f061ca47
|
|
BLAKE2b-256 checksum How to use checksums |
d552940ca2809268b0b502d94eb038c4770d185f14b8f18c0d9f80ea34cba8bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 29, 2026.
Transparency log