Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
213 commits
Select commit Hold shift + click to select a range
5473e0f
define leftone and rightone of BimoduleSector
Feb 24, 2025
85541aa
make left/rightone a new method of TensorKitSectors left/rightone
Feb 24, 2025
cf06437
define leftone and rightone of BimoduleSector
Feb 24, 2025
4390d8d
make left/rightone a new method of TensorKitSectors left/rightone
Feb 24, 2025
09acafc
add tests
Mar 10, 2025
6cb34fa
test reading data from txt
Mar 10, 2025
5c5effd
Merge branch 'boris-multitensorkit' of https://github.com/QuantumKitH…
Mar 10, 2025
a45be26
rewrite extract_Fsymbol to read txt info
Mar 11, 2025
eaa05c9
tests to run locally for my smooth brain
Mar 11, 2025
599b74e
start on adding missing elements of extract_Fsymbol
Mar 14, 2025
b9b0994
change extract_dual to get duals of module cats as well
Mar 14, 2025
2683ad1
update one, leftone, rightone, conj functions with new extract_dual
Mar 14, 2025
c425551
add test to check units and duals
Mar 14, 2025
87c11b3
remove TODO about duals for modules
Mar 14, 2025
66e6ef2
add missing elements of extract_Fsymbol
Mar 14, 2025
adcc5fe
change Fcache definition
Mar 14, 2025
10ee1b6
fix extract_Fsymbol to output something useful
Mar 14, 2025
6236465
go back to correct definition Fcache
Mar 14, 2025
d366a40
Revert "go back to correct definition Fcache"
Mar 14, 2025
383218b
output correct dictionary in extract_Fsymbol
Mar 14, 2025
54b64cd
fix Fcache to new output extract_Fsymbol
Mar 14, 2025
16e683b
add sectorscalartype
Mar 14, 2025
f8d45c3
have a functioning Fsymbol
Mar 14, 2025
c0caddf
add bounds to what A4Object can be defined as
Mar 17, 2025
df9eb3e
remove JSON3 dependency
Mar 17, 2025
7743a00
more local tests
Mar 17, 2025
07dfc6c
actually remove all JSON3 deps
Mar 17, 2025
71f6916
Revert "actually remove all JSON3 deps"
Mar 17, 2025
1f37a92
Revert "remove JSON3 dependency"
Mar 17, 2025
c50f31a
remove Fsymbol code that was JSON dependent
Mar 17, 2025
0d50452
add TensorKit dependency
Mar 17, 2025
013c3d8
define length of SectorValues of A4Object + typo in Base.iterate of S…
Mar 17, 2025
fb74131
export TensorKit hasblock
Mar 24, 2025
9250470
custom TensorKit.blocksectors
Mar 24, 2025
0c7d618
start of TensorKit tests
Mar 24, 2025
a6c9aaf
some tests for bram
Mar 25, 2025
471ce1e
update localtests
Mar 25, 2025
b1afb01
add custom `scalar` for `TensorMap`s of `A4Object`
Mar 27, 2025
0cb5b18
comments and changes in tests
Mar 27, 2025
303876e
start of MPSKit tests
Mar 27, 2025
5c1330e
quick fix to Fsymbol to return 0 when expected to be 0
Apr 7, 2025
a77b77d
get blocksectors working
Apr 8, 2025
5809f77
add BlockTensorKit dependency
Apr 8, 2025
3661102
many many (temporary) dependencies
Apr 8, 2025
4e2c0d5
edit Fsymbol to return correctly shaped zero arrays
Apr 9, 2025
c1255d6
temporary BenchmarkTools dep
Apr 9, 2025
75ec5c0
more tinkering
Apr 9, 2025
50c4614
tests done for QPA infinite
Apr 9, 2025
afb8272
add custom `dim` of `GradedSpace` for `A4Object` to return floats as …
Apr 9, 2025
def64ea
define `oneunit` of `A4Object`-graded vector spaces where possible
Apr 9, 2025
c686b9b
finite tests
Apr 10, 2025
50a14d6
remove unnecessary check in specialised blocksectors
Apr 10, 2025
86525d2
clean up dim and oneunit to accept `GradedSpace{<:BimoduleSector}`
Apr 10, 2025
fedb1e4
clean up `oneunit` of `SumSpace` to accept `SumSpace{<:GradedSpace{<:…
Apr 10, 2025
d5862b6
Fix `dim`
Apr 10, 2025
722ea95
performance improvements
Apr 10, 2025
d5b3006
fix `convert_Fs` to not contain elaborate (useless) identity function
Apr 11, 2025
76df51b
`FiniteExcited` and `changebonds` tests
Apr 11, 2025
b5155bf
time evolution test + `(In)FiniteMPOHamiltonian` constructor w/o `Loc…
Apr 11, 2025
2e64e63
add custom `insertleftunit` and `insertrightunit` to evaluate a valid…
Apr 17, 2025
0f6d4d2
Merge branch 'boris-multitensorkit' of https://github.com/QuantumKitH…
Apr 22, 2025
52063d9
replace `map` with `for` loop
Apr 22, 2025
a700577
Test all pentagons
Apr 22, 2025
ed8019d
more local tests
Apr 23, 2025
0b3d668
update `artifact_path`
Apr 23, 2025
3cce841
Merge branch 'main' of https://github.com/QuantumKitHub/MultiTensorKi…
Apr 23, 2025
0995d18
add file to test caching
May 14, 2025
287bb39
add TensorKit tests
May 14, 2025
f96812f
debugging fun + progress
Jun 4, 2025
87e7502
remove commented code
Jun 4, 2025
9e83815
build empty docs
Jun 4, 2025
8a62f08
add library and pages
Jun 5, 2025
9c1b7cc
add docstring to `BimoduleSector`
Jun 5, 2025
2ee3e0c
add MTK to project to build
Jun 5, 2025
d6957ce
make library
Jun 5, 2025
6d8650b
add structure of manual
Jun 5, 2025
bcb95c1
start on references
Jun 5, 2025
22b01d9
get a reference working
Jun 5, 2025
d50cdc9
progress on body of docs
Jun 6, 2025
5fe6277
more work on body
Jun 6, 2025
b4bd637
add main index
Jun 6, 2025
c644657
add more Fmove images
Jun 6, 2025
c584a89
change `IteratorSize` to actually evaluate `SizeUnknown`
Jun 9, 2025
55c8708
change `blocksectors` definition to be flexible with `GradedSpace` type
Jun 9, 2025
480d944
remove debug elements + clean up error messages
Jun 10, 2025
42e3704
more docs and figs
Jun 13, 2025
96962c0
clean up A4 tests
Jun 13, 2025
d5c6b32
clean up deps and add compat
Jun 13, 2025
564c026
delete local test files
Jun 13, 2025
24e0f4b
format
Jun 13, 2025
d161568
apply some suggested changes
Jun 16, 2025
801a774
TupleTools changes
Jun 16, 2025
aaeb4c3
change `insertleft/rightunit` to evaluate `left/rightoneunit`s
Jun 18, 2025
e08a712
add tests for left and right units
Jun 18, 2025
213e23e
one more suggested change
Jun 18, 2025
1320c3a
more figs and text
Jun 19, 2025
1fc3c26
add and update images + actually display them
Jun 20, 2025
7341a34
replace pdfs with svgs
Jun 20, 2025
03b9d54
change image display
Jun 20, 2025
f40e8ad
some more image fixes
Jun 20, 2025
70cc3bf
clean up existing docs
Jun 20, 2025
7222cc8
use math engine
Jun 20, 2025
a70b569
Merge branch 'main' of https://github.com/QuantumKitHub/MultiTensorKi…
Jun 26, 2025
a549943
update code to account for new N- and F-symbols
Jun 26, 2025
f8c00de
more text
Jun 26, 2025
2bbc946
expand on unitarity check explicitly + make less specific to A4
Jun 30, 2025
cc824ab
update `Fsymbol`
Jun 30, 2025
94eb6d1
remove JSON dependency
Jun 30, 2025
5bd5c12
add pure module F-move unitarity check + clean up tests
Jul 1, 2025
bb6eee3
adapt `TensorKit.scalar`
Jul 16, 2025
71682dc
Simplify by fixing `collect`
Jul 16, 2025
4b1b23a
Merge branch 'main' of https://github.com/QuantumKitHub/MultiTensorKi…
Jul 17, 2025
8afa784
Merge https://github.com/QuantumKitHub/MultiTensorKit.jl into boris-m…
Jul 18, 2025
ee71ed8
add the other unitarity tests
Jul 22, 2025
4b067e5
fix test
Jul 22, 2025
42de755
add compats to Project.toml
Jul 22, 2025
a86643b
remove diagonal checks in `left/rightoneunit`
Jul 24, 2025
847c762
pretty print `BimoduleSector`
Jul 24, 2025
6e9e9eb
add custom css for centering and color inverting (cannot use now for …
Aug 4, 2025
c6c1885
braiding info + start of actual repa4 example
Aug 4, 2025
a5cdaca
include repa4 example
Aug 4, 2025
94d4d13
add arrows to images + colored F-move
Aug 5, 2025
7082cbf
add pentagon image
Aug 6, 2025
c063b48
get assets working
Aug 6, 2025
2a19867
more docs
Aug 6, 2025
a683b85
rename
Aug 6, 2025
cd42e10
invert images + fix existing markdown errors
Aug 6, 2025
9053fa4
change ordering of pages
Aug 6, 2025
854daca
attempt to fix toc
Aug 6, 2025
ec807b7
shorten references title
Aug 6, 2025
1ae9332
second to last touches to example
Aug 6, 2025
f0cf126
some reshuffling
Aug 6, 2025
8434447
add reference to text
Aug 6, 2025
6b92875
fix homvector image
Aug 6, 2025
1a82c4e
fix module fmove images
Aug 6, 2025
1ccb334
more text and cleanup
Aug 6, 2025
9082eb4
add PR comment to workflow
Aug 6, 2025
decc1df
fix to example
Aug 7, 2025
a5ef925
another minor fix
Aug 7, 2025
7de0a8b
add plot and some words to it
Aug 7, 2025
c22b215
fix `blocksectors` to not use `isone`
Aug 7, 2025
6b528c9
introduce `rounddim` for prettiness
Aug 7, 2025
7a8d56a
add link
Aug 8, 2025
74508a3
correct keyword args blocks
Aug 8, 2025
34eaaec
correct docs on TY MF example
Aug 8, 2025
a937e44
add todo for visibility
Aug 8, 2025
db4b577
introduce test setup file
Aug 8, 2025
3ffaee5
refactor unitarity tests
Aug 8, 2025
5967817
acronym MTK
Aug 8, 2025
547c262
add `one` for type bimodulesector
Aug 8, 2025
94292f2
change error thrown for module one evaluation + format
Aug 8, 2025
662efd8
finish up sector tests
Aug 8, 2025
f6b6a59
start on multifusion space tests
Aug 8, 2025
a2f1ec1
custom `zero` of `GradedSpace` and `fuse`
Aug 8, 2025
04bac3d
specify TensorKit module for `SectorDict`
Aug 11, 2025
4870e09
potential overkill fusion tree stuff
Aug 11, 2025
16104fc
finish fusion tree tests (not debugged) + move around imports
Aug 12, 2025
3a1cf23
remove debug elements
Aug 12, 2025
6ed0960
add diagonal tensor tests
Aug 12, 2025
679f6cf
start of tensor tests (modules untested)
Aug 12, 2025
38001e1
almost finish up tensor tests
Aug 12, 2025
b4b838e
specify modules for some functions
Aug 13, 2025
a7d13b3
don't use rounddim because it's messy with SVD with truncdim
Aug 13, 2025
dca4611
shorten tensor tests, fix and/or identify bugs
Aug 13, 2025
d274967
remove export `left/rightoneunit`
Aug 13, 2025
0b4f890
`isone` for `BimoduleSector`s
Aug 14, 2025
ffbd4e0
make `isone` great again in `blocksectors`
Aug 14, 2025
000a976
test for `isone`
Aug 14, 2025
9f953d6
tensorkitsectors advanced compat
Aug 18, 2025
0be6bad
custom spaces for factorization tests for more compatible block sizes
Aug 22, 2025
a1cc53c
round dim of space that's supposed to be integer
Aug 22, 2025
67cc8c8
small refactor of diagonal check
Aug 22, 2025
6e3fca5
remove limited rightorth after new spaces
Aug 22, 2025
5bd32a2
generalise `Base.iterate`
Aug 22, 2025
b4c79c0
correct the `BimoduleSector` inner constructor
Aug 22, 2025
ff01886
generalise `A4Object` to `BimoduleSector` where possible
Aug 22, 2025
49aec8d
fix example image
Aug 25, 2025
b27446d
add Random to Project.toml for tests
Sep 1, 2025
fbc166e
remove `left/rightoneunit` coming from TensorKit (temporary)
Sep 24, 2025
0719edc
update compats
Sep 24, 2025
8fda727
update compat for TensorKit v0.15
Nov 5, 2025
9e718a2
renamings from TensorKit v0.15 + incoming renamings
Nov 5, 2025
ff6af7b
add `allunits`, fix `dual`, revert `insertleft/rightunitspace`
Nov 5, 2025
45e9074
add LinearAlgebra for tests
Nov 21, 2025
2ebd2bb
bump TK version
Dec 22, 2025
557c894
remove BlockTensorKit dep
Dec 22, 2025
f181136
remove compiling BTK
Dec 22, 2025
faacc54
remove TK interface (mostly)
Dec 22, 2025
c2ee53f
tinker with deps and compat
Dec 23, 2025
4f19775
more tinkering
Dec 23, 2025
354cb96
update tests
Dec 23, 2025
0048ec0
get setup included correctly
Dec 23, 2025
15df330
small fix
Dec 23, 2025
ad628dc
abstractvector dispatch
Dec 23, 2025
8e37a8b
format test
Dec 23, 2025
46e4514
comment out TK tests
Dec 23, 2025
8737431
format src
Dec 23, 2025
11aa368
basic properties edit
Dec 23, 2025
e5d99a5
remove `Asymbol` test for modules
Dec 23, 2025
ee3a8e6
start of extension explanation
Feb 10, 2026
6e8b7be
minor changes
Feb 10, 2026
db7b204
line breaks per sentence
Feb 10, 2026
85327e4
remove code reference on theory page
Feb 10, 2026
0e5354b
todos and renamings
Feb 10, 2026
c98be08
Merge branch 'boris-multitensorkit' of https://github.com/QuantumKitH…
Feb 10, 2026
4282ebd
fix toc
Feb 12, 2026
436e622
more on extension + references within package
Feb 12, 2026
ce1e6b8
clarify with image
Feb 12, 2026
10a39d5
proofread implementation
Feb 12, 2026
6dd16a5
change intro header
Feb 12, 2026
071704b
figures with julia colors
Feb 12, 2026
91be425
more cleanup
Feb 12, 2026
6eec414
fix figure and other text
Feb 13, 2026
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/MultiTensorKit.jl/previews/PR${{ github.event.number }}/)'
comment-tag: 'preview-doc'
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ Manifest.toml
benchmark/*.json
docs/Manifest.toml
docs/build/
docs/src/index.md
17 changes: 11 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,30 @@ authors = ["Boris De Vos, Laurens Lootens and Lukas Devos"]
version = "0.1.0"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
TensorKit = "07d1fe3e-3e46-537d-9eac-e9e13d0d4cec"
TensorKitSectors = "13a9c161-d5da-41f0-bcbd-e1a08ae0647f"

[compat]
Aqua = "0.8.9"
Artifacts = "1.10, 1"
JSON3 = "1.14.1"
DelimitedFiles = "1.9"
Pkg = "1"
Random = "1"
SafeTestsets = "0.1"
TensorKitSectors = "0.1.2"
TensorKit = "0.16"
TensorKitSectors = "0.3"
Test = "1.10"
TestExtras = "0.3"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"

[targets]
test = ["Aqua", "SafeTestsets", "Test", "TestExtras"]
test = ["Aqua", "LinearAlgebra", "Random", "SafeTestsets", "Test", "TestExtras"]
4 changes: 4 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
MultiTensorKit = "f0555a46-f681-4ef1-bed5-d64870568636"
27 changes: 27 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Documenter
using DocumenterCitations
# using TensorKitSectors, TensorKit
using MultiTensorKit

pages = ["Home" => "index.md",
"Manual" => ["man/fusioncats.md", "man/multifusioncats.md", "man/extension.md", "man/implementation.md"],
"Library" => "lib/library.md",
"References" => "references.md"]

# bibliography
bibpath = joinpath(@__DIR__, "src", "assets", "MTKrefs.bib")
bib = CitationBibliography(bibpath; style=:authoryear)

mathengine = MathJax3(Dict(:loader => Dict("load" => ["[tex]/physics"]),
:tex => Dict("inlineMath" => [["\$", "\$"], ["\\(", "\\)"]],
"tags" => "ams",
"packages" => ["base", "ams", "autoload", "physics",
"mathtools"])))

makedocs(; sitename="MultiTensorKit.jl", modules=[MultiTensorKit],
authors="Boris De Vos, Laurens Lootens and Lukas Devos",
pages=pages, pagesonly=true, plugins=[bib],
format=Documenter.HTML(; prettyurls=true, mathengine=mathengine,
assets=["assets/custom.css"]))

deploydocs(; repo="https://github.com/QuantumKitHub/MultiTensorKit.jl", push_preview = true)
53 changes: 53 additions & 0 deletions docs/src/assets/MTKrefs.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@book{etingof2016tensor,
title={Tensor Categories},
author={Etingof, P. and Gelaki, S. and Nikshych, D. and Ostrik, V.},
isbn={9781470434410},
lccn={2015006773},
series={Mathematical Surveys and Monographs},
url={https://books.google.be/books?id=Z6XLDAAAQBAJ},
year={2016},
publisher={American Mathematical Society}
}

@article{Lootens_2023,
title={Dualities in One-Dimensional Quantum Lattice Models: Symmetric Hamiltonians and Matrix Product Operator Intertwiners},
volume={4},
ISSN={2691-3399},
url={http://dx.doi.org/10.1103/PRXQuantum.4.020357},
DOI={10.1103/prxquantum.4.020357},
number={2},
journal={PRX Quantum},
publisher={American Physical Society (APS)},
author={Lootens, Laurens and Delcamp, Clement and Ortiz, Gerardo and Verstraete, Frank},
year={2023},
month=jun }

@misc{etingof2009,
title={Fusion categories and homotopy theory},
author={Pavel Etingof and Dmitri Nikshych and Victor Ostrik and with an appendix by Ehud Meir},
year={2009},
eprint={0909.3140},
archivePrefix={arXiv},
primaryClass={math.QA},
url={https://arxiv.org/abs/0909.3140},
}

@misc{henriques2020,
title={Representations of fusion categories and their commutants},
author={André Henriques and David Penneys},
year={2020},
eprint={2004.08271},
archivePrefix={arXiv},
primaryClass={math.OA},
url={https://arxiv.org/abs/2004.08271},
}

@misc{Lootens_2024,
title={Entanglement and the density matrix renormalisation group in the generalised Landau paradigm},
author={Laurens Lootens and Clement Delcamp and Frank Verstraete},
year={2024},
eprint={2408.06334},
archivePrefix={arXiv},
primaryClass={quant-ph},
url={https://arxiv.org/abs/2408.06334},
}
47 changes: 47 additions & 0 deletions docs/src/assets/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.center {
display: block;
margin-left: auto;
margin-right: auto;
}

/* set fixed non-trivial inversion and hue rotation */
:root {
--inversionFraction: 100%;
--hueRotation: -180deg;
}

/* color-invert images */
.color-invertible {
filter: invert(var(--inversionFraction)) hue-rotate(var(--hueRotation)) !important;
-ms-filter: invert(var(--inversionFraction)) !important;
-webkit-filter: invert(var(--inversionFraction)) hue-rotate(var(--hueRotation)) !important;
}
/* including the logo when we make one
.docs-logo {
filter: invert(var(--inversionFraction)) hue-rotate(var(--hueRotation)) !important;
-ms-filter: invert(var(--inversionFraction)) !important;
-webkit-filter: invert(var(--inversionFraction)) hue-rotate(var(--hueRotation)) !important;
} */

/* but disable for the two light themes */
.theme--documenter-light .color-invertible {
filter: invert(0%) hue-rotate(0deg) !important;
-ms-filter: invert(var(0%)) !important;
-webkit-filter: invert(var(0%)) hue-rotate(0deg) !important;
}
.theme--catppuccin-latte .color-invertible {
filter: invert(0%) hue-rotate(0deg) !important;
-ms-filter: invert(var(0%)) !important;
-webkit-filter: invert(var(0%)) hue-rotate(0deg) !important;
}
/* for the logo as well */
/* .theme--documenter-light .docs-logo {
filter: invert(0%) hue-rotate(0deg) !important;
-ms-filter: invert(var(0%)) !important;
-webkit-filter: invert(var(0%)) hue-rotate(0deg) !important;
}
.theme--catppuccin-latte .docs-logo {
filter: invert(0%) hue-rotate(0deg) !important;
-ms-filter: invert(var(0%)) !important;
-webkit-filter: invert(var(0%)) hue-rotate(0deg) !important;
} */
41 changes: 41 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# MultiTensorKit

**TensorKit extension to multifusion categories**

## Package summary
MultiTensorKit.jl provides the user a package to work with multifusion categories, the extension of regular fusion categories where the unit is no longer simple and unique.
Multifusion categories naturally embed the structure of module categories over fusion categories.
Hence, MultiTensorKit.jl allows not only the fusion of objects within the same
fusion category (as TensorKit.jl), but also the fusion with and between module categories over these fusion categories.

MultiTensorKit.jl is built to be compatible with TensorKit, thus allowing the construction of symmetric tensors with new symmetries due to the module structure.
Through this,
tensor network simulations of quantum many-body systems with aid of [MPSKit.jl](https://github.com/QuantumKitHub/MPSKit.jl) can be performed.

## Table of contents

```@contents
Pages = ["man/fusioncats.md", "man/multifusioncats.md", "man/extension.md", "man/implementation.md", "lib/library.md", "references.md"]
Depth = 2
```

## Installation

MultiTensorKit.jl is currently not registered to the Julia General Registry.
You can install the package as
```
pkg> add https://github.com/QuantumKitHub/MultiTensorKit.jl.git
```

## Usage

As the name suggests, MultiTensorKit is an extension of [TensorKit.jl](https://github.com/Jutho/TensorKit.jl) and
[TensorKitSectors.jl](https://github.com/QuantumKitHub/TensorKitSectors.jl).
Therefore, we recommend including TensorKit
to your project.
Additionally, MultiTensorKit was made to be functional with [MPSKit.jl](https://github.com/QuantumKitHub/MPSKit.jl)
and [MPSKitModels.jl](https://github.com/QuantumKitHub/MPSKitModels.jl) for Matrix Product State (MPS) calculations, supporting symmetries
which go beyond TensorKit.
In particular, TensorKit v0.16.0 and MPSKit v0.13.9 contain the necessary functionality to deal with the multifusion categorical structure provided by MultiTensorKit.
All these packages are registered in JuliaRegistries and can be added through the package manager.

5 changes: 5 additions & 0 deletions docs/src/lib/library.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Library

```@autodocs
Modules = [MultiTensorKit]
```
96 changes: 96 additions & 0 deletions docs/src/man/extension.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# [MultiTensorKit as an extension to TensorKit](@id extension)

This section will explain the internal changes to TensorKit which are required to extend the compatibility with fusion categories to multifusion ones.
Users who are unfamiliar with TensorKit are kindly guided towards the [TensorKit tutorial](https://jutho.github.io/TensorKit.jl/stable/man/tutorial/).

## As a `Sector`
MultiTensorKit is at its core an extension to [TensorKitSectors](https://github.com/QuantumKitHub/TensorKitSectors.jl), as it simply provides a new `Sector`, i.e. simple objects of a multifusion category, named `BimoduleSector`.

````julia
struct BimoduleSector{Name} <: Sector
i::Int
j::Int
label::Int
end
````

`i` and `j` specify which subcategory $\mathcal{C}_{ij}$ we are considering, and `label` selects a particular simple object within that subcategory.
`Name` selects which multifusion category to work with, and is a `Symbol`.
As of now, only `:A4` is available, referring to the multifusion category consisting of $\mathsf{Rep(A_4)}$ as the largest fusion category, and all its Morita dual fusion categories and corresponding bimodule categories.
The fusion of these `BimoduleSector`s is then defined by the fusion rules of the multifusion category.
In particular,
````julia
a = BimoduleSector{:A4}(i, j, label1)
b = BimoduleSector{:A4}(k, l, label2)
a ⊗ b # empty unless j == k
````

The fusion rules are read in via the artifact labeled "fusiondata", and are extracted at runtime when calling the fusion of two `BimoduleSector`s (or `Nsymbol`) for the first time.
These data are cached in a hash table for later use.

A consequence of the multifusion structure is the colorings used in the graphical calculus of fusions.
A natural introduction is the notion of a *left* and *right* unit of some (simple) object in the multifusion category.
These are called with the functions `TensorKitSectors.leftunit` and `TensorKitSectors.rightunit`.
Clearly, for the usual case of just one fusion category, these both coincide with the unique unit object.
For this reason, the `TensorKitSectors.UnitStyle` trait is introduced to differentiate between fusion categories and multifusion categories, returning `SimpleUnit()` and `GenericUnit()`, respectively.
This trait is used to specialise certain functions within TensorKit (see below).
`TensorKitSectors.allunits` is also introduced to return all the simple unit objects of the (multi)fusion category.
This function must be defined for every multifusion category to be compatible with TensorKit.

Via the fusion rules, the left and right units of all `BimoduleSector`s along with their duals are also extracted and cached.
The fusion behavior that must be imposed for the entire `BimoduleSector` is the most general one that appears in the fusion between any two `BimoduleSector`s.
In particular, if one of the diagonal fusion categories has fusion rules with multiplicities, then the entire `BimoduleSector` must be set to have `TensorKitSectors.FusionStyle(::Type{<:BimoduleSector}) = GenericFusion()`.
This is the case for the $A_4$ `BimoduleSector`, since $\mathsf{Rep(A_4)}$ is one of the diagonal fusion categories and has fusion rules with multiplicities.

Going beyond the ring structure, the F-symbols are also read in from the artifact, and are stored in a hash table for later use.
The F-symbols are then used to perform F-moves on `BimoduleSector`s, which is required to perform recouplings of fusion trees when doing e.g. contractions of tensors with these categories grading the vector spaces.

Due to the nature of the multifusion category, it is currently not possible to define a non-trivial braiding on the `BimoduleSector`s, so these are set to be non-braided: `TensorKitSectors.BraidingStyle(::Type{<:BimoduleSector}) = NoBraiding()`.
This is especially important when working with matrix product states, as all algorithms are required to remain planar, since no (half-)braiding is available to perform crossings of fusion trees.

## As a symmetry in TensorKit
Since `BimoduleSector`s are `Sector`s, they can be used as symmetries in TensorKit.
This way, we can construct symmetric tensors with the symmetries of the multifusion category, which are more general than those of the fusion categories.
In particular, the vector spaces graded by these `BimoduleSector`s are not only graded by the simple objects of the fusion categories, but also by the simple objects of the bimodule categories.
This allows for more general tensor network simulations of quantum many-body systems with symmetries which go beyond those of fusion categories.

Certain changes within TensorKit were required to make it compatible with the multifusion categorical structure.
In particular, the presence of a simple unit object for every fusion category on the diagonal of the multifusion category, along with the off-diagonal nature of the simple objects of the bimodule categories, required some internal changes to the way unit objects were treated in TensorKit.
Most notably, the unit object is no longer unique, and thus it is of utmost importance that the correct one is considered when performing tensor contractions at the level of the fusion trees.
This is achieved precisely through colorings and the use of `leftunit` and `rightunit`.
For this reason, every fusion tree manipulation which previously involved "the" unit object, now involves the `leftunit` and `rightunit` of some neighboring sector in the manipulation to identify the correct color.
An important example of this is explained in the previous section on [Opposite module categories](@ref opposite_module_categories), namely the mapping of a splitting vertex to a fusion vertex via a B-move.

When manipulating spaces graded by `BimoduleSector`s, one needs to also be careful of which unit spaces can compose with other graded spaces on which side.
This introduces the functions `TensorKit.leftunitspace` and `TensorKit.rightunitspace`, which check whether the coloring of the (in general) composite object grading the space is uniform, then return the one-dimensional space with the unique left/right unit object consistent with that coloring.
Clearly, `leftunitspace` and `rightunitspace` coincide for fusion categories; this defaults to `TensorKit.unitspace`.
For multifusion categories, the latter function returns the space with the semisimple unit object grading it.
`leftunitspace` and `rightunitspace` are used with the functions `TensorKit.insertleftunit` and `TensorKit.insertrightunit`.
There, based on the index where a unit space is wished to be inserted, a `leftunitspace` or `rightunitspace` is added such that the resulting space remains consistent with the fusion rules of the multifusion category.
Similarly, `TensorKit.removeunit` is used to remove unit spaces, and will explicitly check whether the space contains only unit objects of any color with `TensorKit.isunitspace`.

## MultiTensorKit compatibility with MPSKit

This section will briefly explain the changes within MPSKit which are required to make it compatible with MultiTensorKit.
For a more practical explanation, users are kindly guided towards the [Example section](@ref implementation).

The main change within MPSKit is very similar to the fusion tree manipulations in TensorKit, namely the use of `leftunit` and `rightunit` to identify the correct unit object.
In the case of MPSKit, trivial spaces are used everywhere, from the boundary of a finite matrix product state to the virtual spaces of a Hamiltonian written as an matrix product operator.
Additionally, multiple tensor contractions made use of braiding tensors to perform crossings of legs of the MPSs/MPOs.
Since no (half-)braiding is available for the `BimoduleSector`s, all algorithms had to be made planar, and thus all braiding tensors were removed.
Since all braidings were trivial, this was dealt with by simply removing the braiding tensors and replacing the crossing of legs with a termination and reintroduction of the legs without crossing by aid of `removeunit`, `insertleftunit` and `insertrightunit`.

At the level of the MPS, the correct unit object can be identified through the use of `leftunit(ψ::AbstractMPS)` and `rightunit(ψ::AbstractMPS)`.
When the virtual space of the MPS is graded by a diagonal `BimoduleSector`, i.ea unitary fusion category, then these all coincide with the unique unit object of that fusion category.
However, when the virtual space is graded by an off-diagonal `BimoduleSector`, i.e. a bimodule category, then the left and right units are different, and thus it is important to identify the correct one when performing MPS algorithms.
For example, Hamiltonians should always have the same coloring as the right unit of the MPS, since they are contracted at the physical level of the MPS.
Similarly, excitations of an MPS are labeled by `BimoduleSector`s with the same coloring as the left unit of the MPS, since the auxiliary charge leg of the excitation is attached on the other side of the MPS to the virtual level.
This is illustrated in the following figure.

```@raw html
<img src="../img/anyonchain_excitation.svg" alt="" width="70%"/>
```

Here, $\mathcal{D}$ is the fusion category grading the physical space of the MPS, $\mathcal{R}$ is the right $\mathcal{D}$-module category grading the virtual space of the MPS.
$\mathcal{E}$ is the Morita dual fusion category of $\mathcal{D}$ with respect to $\mathcal{R}$, which is the category labelling the excitations of the MPS.
In this case, the left unit of the MPS is in $\mathcal{E}$, and the right unit in $\mathcal{D}$.
Loading