Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/PR_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Docs preview comment
on:
pull_request:
types: [labeled]

permissions:
pull-requests: write
jobs:
pr_comment:
runs-on: ubuntu-latest
steps:
- name: Create PR comment
if: github.event_name == 'pull_request' && github.repository == github.event.pull_request.head.repo.full_name && github.event.label.name == 'documentation'
uses: thollander/actions-comment-pull-request@v3
with:
message: 'After the build completes, the updated documentation will be available [here](https://quantumkithub.github.io/TensorKitSectors.jl/previews/PR${{ github.event.number }}/)'
comment-tag: 'preview-doc'
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
TensorKitSectors = "13a9c161-d5da-41f0-bcbd-e1a08ae0647f"
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"

[compat]
Documenter = "1"
35 changes: 35 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,41 @@ makedocs(;
),
pages = [
"Home" => "index.md",
"Sector Interface" => [
"Overview" => "interface/overview.md",
"Required Methods" => "interface/required.md",
"Optional Methods" => "interface/optional.md",
"Traits and Styles" => "interface/traits.md",
"Implementation Guidelines" => "interface/guidelines.md",
],
"Sector Types" => [
"Overview" => "sectors.md",
"Abelian Groups" => [
"Trivial" => "sectors/abelian/trivial.md",
"ℤₙ (Cyclic)" => "sectors/abelian/zn.md",
"U₁" => "sectors/abelian/u1.md",
],
"Non-Abelian Groups" => [
"SU₂" => "sectors/nonabelian/su2.md",
"CU₁" => "sectors/nonabelian/cu1.md",
"Dₙ (Dihedral)" => "sectors/nonabelian/dn.md",
"A₄ (Alternating)" => "sectors/nonabelian/a4.md",
],
"Anyonic Sectors" => [
"PlanarTrivial" => "sectors/anyons/planartrivial.md",
"Fibonacci" => "sectors/anyons/fibonacci.md",
"Ising" => "sectors/anyons/ising.md",
],
"Fermionic Sectors" => [
"Fermion Parity" => "sectors/fermions/parity.md",
"Fermion Number" => "sectors/fermions/number.md",
"Fermion Spin" => "sectors/fermions/spin.md",
],
"Composite Sectors" => [
"Product" => "sectors/composite/product.md",
"Time-Reversed" => "sectors/composite/timereversed.md",
],
],
"Library" => "lib.md",
],
checkdocs = :exports,
Expand Down
10 changes: 4 additions & 6 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

A Julia package for working with objects in fusion categories.

This package provides functionality for defining objects in fusion categories, along with
their topological data. This includes the fusion rules, the associators, and the braiding.
In particular, this is the data that is needed to define (symmetric) tensors, which are
defined over vector spaces graded by these objects. For the full functionality, we refer to
[TensorKit.jl](https://github.com/QuantumKitHub/TensorKit.jl) and [its
documentation](https://quantumkithub.github.io/TensorKit.jl/stable/).
This package provides functionality for defining objects in fusion categories, along with their topological data.
This includes the fusion rules, the associators, and the braiding.
In particular, this is the data that is needed to define (symmetric) tensors, which are defined over vector spaces graded by these objects.
For the full functionality, we refer to [TensorKit.jl](https://github.com/QuantumKitHub/TensorKit.jl) and [its documentation](https://quantumkithub.github.io/TensorKit.jl/stable/).

Install via the package manager.
63 changes: 63 additions & 0 deletions docs/src/interface/guidelines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
```@meta
CollapsedDocStrings = true
```

# Implementation Guidelines

This section provides practical advice for implementing new sector types efficiently and correctly.

## Helper Type: SectorProductIterator

Instead of materializing all fusion outputs in a tuple or array, one can use `SectorProductIterator` for type-stable, lazy iteration.

```@docs; canonical = false
TensorKitSectors.SectorProductIterator
```

This is enabled by default, and new sectors should provide implementations for the following functions:

```julia
Base.iterate(ab::SectorProductIterator{I}, [state]) = ...
# optional optimizations:
Base.IteratorSize(::Type{SectorProductIterator{I}}) = HasLength()
Base.length(ab::SectorProductIterator{I}) = ...
```

This has the benefit of helping with type stability, and has a pretty-printing overload:

```@example
using TensorKitSectors # hide
SU2Irrep(1) ⊗ SU2Irrep(1)
```

## Shape of Topological Data

The size of [`Fsymbol`](@ref) and [`Rsymbol`](@ref) data depends on the fusion multiplicities ([`Nsymbol`](@ref)).
For multiplicity‑free sectors scalars are sufficient; for generic fusion we need arrays.
Therefore, we distinguish the behavior through the [`FusionStyle`](@ref).


### [`MultiplicityFreeFusion`](@ref)

- `Nsymbol(a, b, c)`: Returns a `Bool`.
- `Fsymbol(a, b, c, d, e, f)`: Returns a scalar of type `sectorscalartype(I)`.
- `Rsymbol(a, b, c)`: Returns a scalar of type `sectorscalartype(I)`.

Additionally, if the [`Fsymbol`](@ref) and [`Rsymbol`](@ref) do not correspond to valid fusion channels, the result is ``0``.
Therefore, computing the number of valid fusion channels for both diagrams as the product of the relevant [`Nsymbol`](@ref)s, we have:

```math
Comment thread
lkdvos marked this conversation as resolved.
\left(N^{ab}_e N^{ec}_d = 0 \lor N^{af}_d N^{bc}_f = 0\right) \implies (F_{abc}^d)^e_f = 0
```

```math
N^{ab}_c = 0 \implies R^{ab}_c = 0
```

### [`GenericFusion`](@ref)

- `Nsymbol(a, b, c)`: Returns a positive `Integer`.
- `Fsymbol(a, b, c, d, e, f)`: Returns a ``N^{ab}_e \times N^{ec}_d \times N^{af}_d \times N^{bc}_f`` array of `sectorscalartype(I)` elements.
- `Rsymbol(a, b, c)`: Returns a ``N^{ab}_c \times N^{ba}_c`` array of `sectorscalartype(I)` elements.

Here invalid fusion channels will necessarily lead to empty arrays.
96 changes: 96 additions & 0 deletions docs/src/interface/optional.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
```@meta
CollapsedDocStrings = true
```

# Optional Methods

The following methods have default implementations but can be overridden for performance or to provide additional functionality.

## Quantum Dimensions

The quantum dimension of a sector is a fundamental invariant that determines the behavior of fusions and braiding.
The default implementation extracts the dimension from [`Fsymbol`](@ref) via the quantum dimension formula.

```math
Comment thread
lkdvos marked this conversation as resolved.
d_a = \left| \frac{1}{(F_{a \bar{a} a}^a)^{1_a}_{_a1} } \right|
```

For many common sectors, however, the dimension is known directly from representation theory.
In these cases, it can be beneficial to overload [`dim`](@ref) to bypass computing F-symbols, either for performance reasons or to enforce tighter output types.
For example, dimensions of irreducible representations of groups are always integers.

```@docs; canonical = false
dim
sqrtdim
invsqrtdim
```

## Frobenius-Schur Indicators

The Frobenius-Schur indicator and phase characterize the self-duality properties of sectors.

```math
\kappa_a = \text{sign}\left( (F_{a \bar{a} a}^a)^{1_a}_{_a1} \right)
Comment thread
lkdvos marked this conversation as resolved.
```

The indicator distinguishes real, complex, and quaternionic representations.
The phase is the category-theoretic version that appears in line bending operations.

```@docs; canonical = false
frobenius_schur_indicator
frobenius_schur_phase
```

## Scalar Type

Various utility functions exist for determining what number type is used in various parts of the topological data.

```@docs; canonical = false
fusionscalartype
braidingscalartype
dimscalartype
sectorscalartype
```

!!! note
While there is a fallback definition that tries to determine the result from computing the functions on the unit sector,
it is often a good idea to define this method explicitly to avoid depending on compiler heuristics to constant-fold these calls.

## Topological Data Symbols

The [`Asymbol`](@ref), [`Bsymbol`](@ref) and [`twist`](@ref) are derived from F- and R-symbols but are often occurring combinations.
The A-symbol and B-symbol relate different ways of bending strands, while the twist is the topological spin (quantum dimension phase) of a sector.

The A-symbol ``A^{ab}_c`` relates splitting and fusion vertices:
```math
A^{ab}_c = \sqrt{\frac{d_a d_b}{d_c}} \overline{\kappa_a} (F_{\bar{a} a b}^b)^1_c
```

The B-symbol ``B^{ab}_c`` relates splitting and fusion vertices:
```math
B^{ab}_c = \sqrt{\frac{d_a d_b}{d_c}} (F_{a b \bar{b}}^a)^c_1
```

The twist ``\theta_a`` of a sector is the topological spin phase, computed as the trace of the R-matrix for braiding a sector with itself:
```math
\theta_a = \frac{1}{d_a} \sum_{b \in a \otimes a} d_b \text{tr}(R^{aa}_b)
```

```@docs; canonical = false
Asymbol
Bsymbol
twist
```

## Fusion Basis

The fusion tensor provides explicit matrix elements for the tensor product of representations.
It is a rank-4 array whose components are the Clebsch-Gordan coefficients for fusing sector `a` and `b` into `c`.
The fusion tensor is not uniquely determined by topological data alone, instead the topological data can be extracted from it when it is available.
However, there is not always a concrete representation of these tensors in terms of simple `Array` objects, and the exact representation is not important for TensorKit.jl.
For this reason, it is optional: TensorKit can work with the topological data alone.
Note however that they are still required whenever we want to convert symmetric tensors to and from dense arrays.

```@docs; canonical = false
fusiontensor
```
32 changes: 32 additions & 0 deletions docs/src/interface/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Sector Interface

## Introduction

A `Sector` is a label for the different *symmetry charges* or *quantum numbers* that organize graded vector spaces.
In particular, these are the labels use to decompose vector spaces as:

```math
V = \bigoplus_{a \in \text{Sectors}} \mathbb{C}^{n_a} \otimes V_a
```

where ``n_a`` is the multiplicity of sector ``a`` and ``V_a`` is the associated vector space.

Sectors encode the structural rules TensorKit needs:
- **Objects**: the labels themselves (irreps, anyons, …)
- **Fusion rules**: which labels appear in ``a \otimes b \rightarrow \bigoplus_c N^{ab}_c c``
- **Associativity**: how different parenthesizations are related
- **Braiding**: how labels behave under exchange (if supported)

More rigorously, a `Sector` represents the isomorphism classes of simple objects in unitary and pivotal fusion categories.
This package defines an interface for accessing the topological data that is associated to these categories.
This section explains the required and optional methods needed to create a new sector type.
Once this interface is fulfilled, TensorKit.jl will create symmetric tensors that correspond to the implemented sector.

## Organization

The interface documentation is divided into several pages:

- **[Required Methods](required.md)**: The minimum interface needed for a valid sector type
- **[Optional Methods](optional.md)**: Additional methods with default implementations that can be specialized
- **[Traits and Styles](traits.md)**: Compile-time properties that control behavior and optimizations
- **[Implementation Guidelines](guidelines.md)**: Practical advice and helper types for implementing sectors
Loading
Loading