Skip to content

R-Symbol

Permutation transformation on the outer-multiplicity space of a CG tensor.

compute_rsymbol

compute_rsymbol(spec, permutation) -> Tuple[np.ndarray, object]

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:

  • R-symbol array of shape [om_original, om_permuted].
  • Permuted CGSpec with edges reordered according to permutation.

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:

\[R^{\mu'}_{\mu} = \langle \text{permuted},{\mu'} | \text{original},\mu \rangle\]

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:

\[R^\top R = R R^\top = I\]

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:

\[R(\sigma \circ \pi) = R(\sigma)\, R(\pi)\]

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

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.