R-Symbol¶
Permutation transformation on the outer-multiplicity space of a CG tensor.
compute_rsymbol
¶
Compute R-symbol for tensor edge permutation with caching.
The R-symbol represents how outer multiplicity indices transform under permutation of tensor edges. Results are cached to avoid redundant computations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec
|
CGSpec
|
The CGSpec to permute. |
required |
permutation
|
list[int]
|
Permutation of external edge indices. Must be a valid permutation (each index from 0 to num_external-1 appears exactly once). |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, CGSpec]
|
A tuple containing:
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the permutation is invalid. |
RuntimeError
|
If computation fails. |
Examples:
>>> import yuzuha
>>> j_half = yuzuha.Spin(1)
>>> spec = yuzuha.CGSpec.from_edges([
... yuzuha.Edge.incoming(j_half),
... yuzuha.Edge.incoming(j_half),
... yuzuha.Edge.incoming(j_half),
... yuzuha.Edge.incoming(j_half)
... ])
>>> # Swap first two edges
>>> permutation = [1, 0, 2, 3]
>>> r_array, spec_permuted = yuzuha.compute_rsymbol(spec, permutation)
>>> print(r_array.shape)
(2, 2)
Notes
The first call for a given set of parameters will compute the result and cache it. Subsequent calls with the same parameters will return the cached result, which is typically much faster.
Description¶
The R-symbol \(R^{\mu'}_{\mu}\) is a real unitary matrix that encodes how the outer-multiplicity (OM) index transforms when the external edges of a CG tensor are permuted:
The shape of the returned array is (om_original, om_permuted).
For OM dimension 1, the R-symbol is a \(1 \times 1\) matrix whose single entry is \(\pm 1\) (the permutation phase). For higher OM dimensions it is a proper unitary matrix.
Usage¶
import yuzuha
jhalf = yuzuha.Spin(1) # j = 1/2
spec = yuzuha.CGSpec.from_edges([
yuzuha.Edge.incoming(jhalf),
yuzuha.Edge.incoming(jhalf),
yuzuha.Edge.incoming(jhalf),
yuzuha.Edge.outgoing(yuzuha.Spin(3)), # j = 3/2
])
# Swap the first two edges
permutation = [1, 0, 2, 3]
r_array, spec_permuted = yuzuha.compute_rsymbol(spec, permutation)
print(r_array.shape) # (om_original, om_permuted)
print(r_array.dtype) # float64
# Identity permutation gives the identity matrix
identity_perm = [0, 1, 2, 3]
r_id, _ = yuzuha.compute_rsymbol(spec, identity_perm)
import numpy as np
assert np.allclose(r_id, np.eye(spec.om_dimension()))
Unitarity¶
The R-symbol is always unitary:
This can be verified for any spec and permutation:
import numpy as np
r, _ = yuzuha.compute_rsymbol(spec, [1, 0, 2, 3])
assert np.allclose(r.T @ r, np.eye(r.shape[1]))
Composition¶
R-symbols compose correctly under permutation composition:
Caching¶
The first call for a given (spec, permutation) pair stores the result in
.yuzuha/rsymbol.db. Subsequent calls return the cached value immediately.
See Also¶
- X-Symbol: Contraction recoupling coefficients
- Canonical Basis: The basis from which R-symbols are derived
- CGSpec: Input specification type
- Yuzuha Protocol — Symbol Interface: Formal specification of the R-symbol interface
Notes¶
The permutation is specified as a list of destination indices: permutation[i] is
the index in the original spec that moves to position i in the permuted spec.
That is, spec_permuted.edge_at(i) == spec.edge_at(permutation[i]).
An invalid permutation (wrong length, out-of-range indices, or repeated indices) raises
ValueError.