Skip to content

Index

Symmetry-aware tensor index defining direction, group, and charge sectors.

Index dataclass

Index(
    direction: Direction,
    group: SymmetryGroup,
    sectors: Tuple[Sector, ...] = tuple(),
)

Symmetry-aware tensor index capturing direction, group, and charge sectors. Keeps tensor indices self-consistent so fusion and splitting utilities can rely on validated charges. The flipping pair streamline common tensor network rewrites.

Attributes:

Name Type Description
direction Direction

Orientation of the index (e.g. bra vs ket index). Flips determine how charge conjugation is applied.

group SymmetryGroup

Symmetry group object responsible for validating and fusing charges.

sectors Tuple[Sector, ...]

Tuple of (charge, dim) pairs describing the block structure available on this index.

dim (property)

Property returning the total dimension derived from sectors.

Methods:

Name Description
dual

Reverse orientation with or without charge conjugation to suit diagram manipulations.

Attributes

dim property

dim: int

Total dimension of the index after summing over all sectors.

num_states property

num_states: int

Total number of physical states accounting for irrep dimensions.

Functions

flip

flip() -> Index

Return a copy with direction flipped but raw charge sectors untouched.

dual

dual() -> Index

Return the dual index with direction reversed and conjugated charges.

charges

charges() -> Tuple[Charge, ...]

Return the immutable sequence of charges carried by this index.

sector_dim_map

sector_dim_map() -> Dict[Charge, int]

Map each sector's charge to its dimension for quick lookups.

Description

An Index represents a single index of a tensor, specifying:

  • Direction: Direction.OUT or Direction.IN
  • Symmetry Group: The group governing charge conservation
  • Sectors: Available charge sectors with their dimensions

Indices are immutable (frozen dataclasses) to ensure consistency across tensor operations.

Direction Rules

  • Direction.OUT: Charge contributes with positive sign (+)
  • Direction.IN: Charge contributes with negative sign (-)

For charge conservation: ∑(OUT) - ∑(IN) = neutral

Methods

flip()

Returns a copy with direction reversed but charges unchanged.

dual()

Returns a copy with direction reversed AND charges conjugated.

See Also

Notes

For contraction, indices must have: 1. Opposite directions (OUT ↔ IN) 2. Same symmetry group 3. Compatible charge sectors