-
Notifications
You must be signed in to change notification settings - Fork 5
Documentation overhaul #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
7607f73
docs: set up documentation skeleton
lkdvos cf59c97
docs: document required sector interface methods
lkdvos 3a5e123
docs: document optional sector interface methods
lkdvos 44fdfa6
docs: document trait-based dispatch
lkdvos bec932b
docs: add implementation guidelines for new sectors
lkdvos fba44f9
docs: document SU2Irrep sector
lkdvos 7e56317
ci: add PR_comment workflow
lkdvos da40bfe
a4
borisdevos 1d94788
minor su2 changes
borisdevos eec4428
small a4 change
borisdevos 6e7a417
u1
borisdevos 4d6a31f
trivial and planartrivial
borisdevos 522de26
ising and fibonacci
borisdevos 4776631
zn
borisdevos f5d8892
fermions
borisdevos 7d15f9e
dn
borisdevos cef7492
cu1
borisdevos deb2cc0
product and timereversed
borisdevos cacb039
jldoctest block fix
borisdevos 13f54b5
Merge branch 'main' of https://github.com/QuantumKitHub/TensorKitSect…
borisdevos ef2e225
add heisenbergirrep
borisdevos d8dc9c1
znelement
borisdevos 96c55e1
give love to `deligneproduct`
borisdevos 7383584
update summary table + add new pages
borisdevos 6eb82ae
Merge branch 'main' of https://github.com/QuantumKitHub/TensorKitSect…
borisdevos c6b6434
same same but different
borisdevos 01aa7b8
docs: fix SU2Irrep F-symbol formula (d/e were swapped)
lkdvos 8fc22b0
docs: fix HeisenbergIrrep braiding in summary table (Anyonic -> Bosonic)
lkdvos b2428dd
docs: conjugate F-symbol in A-symbol formula
lkdvos ec8d48c
docs: drop non-existent 'boxtimes' from ProductSector page
lkdvos a9f924f
docs: fix imprecise 'semion-like' claim for ZNElement N=4,p=2
lkdvos 9630336
docs: clarify only length is required for HasLength sectors
lkdvos 0eb5267
docs: drop misleading 'by default' from values(I) description
lkdvos 54ddb05
docs: note fusiontensor has no default in optional-methods intro
lkdvos 9faee01
docs: distinguish Frobenius-Schur phase from indicator
lkdvos 24db58c
docs: specify DNIrrep R-symbol sign applies to the (0,-) channel only
lkdvos bc77f1b
docs: fix tautological dimension count in HeisenbergIrrep fusion
lkdvos e698d61
docs: fix typo 'labels use to decompose' -> 'used to'
lkdvos ac0b7cd
docs: fix typo 'all twist' -> 'all twists' in ZNIrrep page
lkdvos e9185c1
docs: normalize section-heading capitalization to Title Case
lkdvos 2835db1
docs: use bracket notation Rep[Zn] in summary table for consistency
lkdvos 4c822a6
docs: rename nav category 'Group Sectors' -> 'Group Elements'
lkdvos 236bfa9
docs: cross-reference ZNElement from the ZNIrrep page
lkdvos 33f2c83
docs: add install command and next-steps pointers to landing page
lkdvos 6e85037
docs: add NamedSector page, nav entry, and summary-table row
lkdvos 7331f5a
docs: document multifusion support and IsingBimodule example
lkdvos 3ab69ba
docs: make CU1Irrep iteration example a runnable jldoctest
lkdvos 6b5eb92
docs: use Unicode for math symbols and Greek letters (interface pages)
lkdvos 64d9da4
docs: use Unicode for math symbols and Greek letters (sector pages)
lkdvos 7a1bf3d
Apply suggestions from code review
lkdvos 43481f7
more updates from suggestions
lkdvos d9b6d8a
small typos
lkdvos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| \left(N^{ab}_e N^{ec}_d = 0 ∨ N^{af}_d N^{bc}_f = 0\right) ⟹ (F_{abc}^d)^e_f = 0 | ||
| ``` | ||
|
|
||
| ```math | ||
| N^{ab}_c = 0 ⟹ 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 × N^{ec}_d × N^{af}_d × N^{bc}_f`` array of `sectorscalartype(I)` elements. | ||
| - `Rsymbol(a, b, c)`: Returns a ``N^{ab}_c × N^{ba}_c`` array of `sectorscalartype(I)` elements. | ||
|
|
||
| Here invalid fusion channels will necessarily lead to empty arrays. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| ```@meta | ||
| CollapsedDocStrings = true | ||
| ``` | ||
|
|
||
| # Optional Methods | ||
|
|
||
| Most of the following methods have default implementations derived from the required methods, but can be overridden for performance or to provide additional functionality. | ||
| The exception is [`fusiontensor`](@ref), which has no default: it is genuinely optional and, when needed, must be supplied explicitly (see the Fusion Basis section below). | ||
|
|
||
| ## 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 | ||
|
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. | ||
| The Frobenius-Schur phase ``κ_a`` is obtained from the F-symbol as | ||
|
|
||
| ```math | ||
| κ_a = \text{sign}\left( (F_{a \bar{a} a}^a)^{1_a}_{_a1} \right) | ||
| ``` | ||
|
|
||
| and is the category-theoretic quantity that appears in line-bending operations. | ||
| The Frobenius-Schur indicator ``ν_a`` coincides with ``κ_a`` for self-dual sectors (``a = \bar{a}``) and is ``0`` otherwise; it distinguishes real, complex, and quaternionic representations. | ||
|
|
||
| ```@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{κ_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 ``θ_a`` of a sector is the topological spin phase, computed as the trace of the R-matrix for braiding a sector with itself: | ||
| ```math | ||
| θ_a = \frac{1}{d_a} \sum_{b ∈ a ⊗ 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 | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 used to decompose vector spaces as: | ||
|
|
||
| ```math | ||
| V = \bigoplus_{a ∈ \text{Sectors}} ℂ^{n_a} ⊗ 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 ⊗ b → \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 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.