Isotypic projectors¶
Isotypic projectors on \((\mathbb{C}^d)^{\otimes n}\).
The isotypic projector cuts \((\mathbb{C}^d)^{\otimes n}\) down to the \(\lambda\) block. It is a class sum of the permutation action \(U(\sigma)\), which shuffles the tensor factors:
isotypic_proj builds this as a dense \(d^n \times d^n\) matrix, which gets
expensive fast. When you only need to apply it, apply_isotypic_proj sums the
permuted copies of the tensor directly, so nothing larger than the input is
ever allocated. The \(n\) axes you name are the tensor factors, in slot order;
every other axis is carried along untouched, which lets you project a batch of
tensors, or one leg of a larger network, in a single call.
Examples:
>>> import numpy as np
>>> from schur_weyl import partitions, isotypic_proj, apply_isotypic_proj
>>> P = isotypic_proj((2, 1), d=2)
>>> P.shape, bool(np.allclose(P @ P, P))
((8, 8), True)
Axes 0 and 4 ride along, and the blocks resolve the identity:
>>> T = np.random.default_rng(0).normal(size=(4, 2, 2, 2, 5))
>>> apply_isotypic_proj(T, (2, 1), axes=(1, 2, 3)).shape
(4, 2, 2, 2, 5)
>>> bool(np.allclose(sum(apply_isotypic_proj(T, lam, axes=(1, 2, 3)) for lam in partitions(3)), T))
True
isotypic_proj ¶
Return the isotypic projector acting on \((C^d)^{\otimes k}\)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lam
|
tuple[int, ...]
|
The partition k = sum(lam) |
required |
d
|
int
|
The basis dimension |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The projector |
Source code in src/schur_weyl/isotypic.py
apply_isotypic_proj ¶
apply_isotypic_proj(tensor: ndarray, lam: tuple[int, ...], axes: tuple[int, ...] | None = None) -> np.ndarray
Apply the isotypic projector \(P_\lambda\) along the chosen axes of a tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
ndarray
|
The tensor to project. |
required |
lam
|
tuple[int, ...]
|
The partition |
required |
axes
|
tuple[int, ...] | None
|
The k axes carrying the tensor factors. Defaults to the first k axes. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The projected tensor, of the same shape as tensor. |
Examples:
>>> import numpy as np
>>> v = np.arange(8.0).reshape(2, 2, 2)
>>> p = apply_isotypic_proj(v, (2, 1))
>>> bool(np.allclose(apply_isotypic_proj(p, (2, 1)), p))
True