Skip to content

Commit cddfaa6

Browse files
authored
Merge pull request #140 from Jutho/jh/tensorstructure
WIP: redesign tensormap structure
2 parents 2bb4c2b + aca1263 commit cddfaa6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2856
-1861
lines changed

.github/workflows/CI.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
version:
24-
- '1.10' # LTS version
25-
# - '1' # TODO: add back when 1.10 is LTS
24+
- '1'
25+
- 'lts'
2626
os:
2727
- ubuntu-latest
2828
- macOS-latest

Changelog.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Features that are planned to be implemented before the release of v1.0.0, in no particular order.
44

55
- [x] Separate `Sectors` module
6-
- [ ] Make `TrivialTensorMap` and `TensorMap` be the same
7-
- [ ] Simplify `TensorMap` type to hide `rowr` and `colr`
8-
- [ ] Change block order in `rowr` / `colr` to speed up particular contractions
6+
- [x] Make `TrivialTensorMap` and `TensorMap` be the same
7+
- [x] Simplify `TensorMap` type to hide `rowr` and `colr`
8+
- [x] Change block order in `rowr` / `colr` to speed up particular contractions
99
- [x] Make `AdjointTensorMap` generic
1010
- [ ] Rewrite planar operations in order to be AD-compatible
1111
- [x] Fix rrules for fermionic tensors
@@ -47,3 +47,17 @@ as there are some changes in the API.
4747

4848
This promotes TensorKitSectors to its own package, in order to make the dependencies
4949
lighter and to separate the concerns of the two packages.
50+
51+
### FusionTree vertices
52+
53+
In order to simplify the `FusionTree` struct, we removed the usage of anything other than
54+
`Int` as a vertex-label when working with `GenericFusion` sectors.
55+
56+
### TensorStructure
57+
58+
This PR changed the data structure of `TensorMap` to consist of a single vector of data,
59+
where all blocks and subblocks are various views into this object. This entails major
60+
simplifications for the outwards-facing interface, as now the `TensorMap` type requires less
61+
parameters, and the fusion-tree structure is more clearly considered as an implementation
62+
detail that can be left hidden to the user. Various other improvements and documentation
63+
work was also carried out.

Project.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
name = "TensorKit"
22
uuid = "07d1fe3e-3e46-537d-9eac-e9e13d0d4cec"
33
authors = ["Jutho Haegeman"]
4-
version = "1.0.0-DEV"
4+
version = "0.13.0"
55

66
[deps]
77
LRUCache = "8ac3fa9e-de4c-5943-b1dc-09c6b5f20637"
88
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
99
PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930"
1010
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
11+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1112
Strided = "5e0ebb24-38b0-5f93-81fe-25c709ecae67"
1213
TensorKitSectors = "13a9c161-d5da-41f0-bcbd-e1a08ae0647f"
1314
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
@@ -32,11 +33,12 @@ LRUCache = "1.0.2"
3233
LinearAlgebra = "1"
3334
PackageExtensionCompat = "1"
3435
Random = "1"
36+
SparseArrays = "1"
3537
Strided = "2"
3638
TensorKitSectors = "0.1"
37-
TensorOperations = "5"
39+
TensorOperations = "5.1"
3840
Test = "1"
39-
TestExtras = "0.2"
41+
TestExtras = "0.2,0.3"
4042
TupleTools = "1.1"
4143
VectorInterface = "0.4"
4244
julia = "1.10"

docs/Project.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
4+
TensorKitSectors = "13a9c161-d5da-41f0-bcbd-e1a08ae0647f"
35

46
[compat]
5-
Documenter = "0.25 - 0.30"
7+
Documenter = "1"
8+
Random = "1"
9+
TensorKitSectors = "0.1"

docs/make.jl

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
using Documenter
2-
using TensorKit
2+
using Random
3+
using TensorKit, TensorKitSectors
34

4-
makedocs(; modules=[TensorKit],
5+
pages = ["Home" => "index.md",
6+
"Manual" => ["man/intro.md", "man/tutorial.md", "man/categories.md",
7+
"man/spaces.md", "man/sectors.md", "man/tensors.md"],
8+
"Library" => ["lib/sectors.md", "lib/spaces.md", "lib/tensors.md"],
9+
"Index" => ["index/index.md"]]
10+
11+
makedocs(; modules=[TensorKit, TensorKitSectors],
512
sitename="TensorKit.jl",
613
authors="Jutho Haegeman",
14+
warnonly=[:missing_docs, :cross_references],
715
format=Documenter.HTML(; prettyurls=get(ENV, "CI", nothing) == "true",
816
mathengine=MathJax()),
9-
pages=["Home" => "index.md",
10-
"Manual" => ["man/intro.md", "man/tutorial.md", "man/categories.md",
11-
"man/spaces.md", "man/sectors.md", "man/tensors.md"],
12-
"Library" => ["lib/sectors.md", "lib/spaces.md", "lib/tensors.md"],
13-
"Index" => ["index/index.md"]])
17+
pages=pages,
18+
pagesonly=true)
1419

1520
deploydocs(; repo="github.com/Jutho/TensorKit.jl.git", push_preview=true)

docs/src/lib/sectors.md

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ FermionNumber
2222
FermionSpin
2323
FibonacciAnyon
2424
IsingAnyon
25-
FusionTree
2625
```
2726

2827
## Useful constants
@@ -35,16 +34,50 @@ Irrep
3534
Base.one(::Sector)
3635
dual(::Sector)
3736
Nsymbol
37+
3838
Fsymbol
3939
Rsymbol
4040
Bsymbol
4141
dim(::Sector)
4242
frobeniusschur
4343
twist(::Sector)
4444
Base.isreal(::Type{<:Sector})
45-
TensorKit.vertex_labeltype
46-
TensorKit.vertex_ind2label
47-
⊠(::Sector, ::Sector)
45+
TensorKitSectors.sectorscalartype
46+
deligneproduct(::Sector, ::Sector)
47+
```
48+
49+
Compile all revelant methods for a sector:
50+
51+
```@docs
52+
TensorKitSectors.precompile_sector
53+
```
54+
55+
56+
## Types and methods for groups
57+
58+
Types and constants:
59+
60+
```julia
61+
# TODO: add documentation for the following types
62+
Group
63+
TensorKitSectors.AbelianGroup
64+
U₁
65+
ℤ{N} where N
66+
SU{N} where N
67+
const SU₂ = SU{2}
68+
ProductGroup
69+
```
70+
71+
Specific methods:
72+
73+
```@docs
74+
×
75+
```
76+
77+
78+
## Methods for defining and generating fusion trees
79+
```@docs
80+
FusionTree
4881
fusiontrees(uncoupled::NTuple{N,I}, coupled::I,
4982
isdual::NTuple{N,Bool}) where {N,I<:Sector}
5083
```
@@ -63,16 +96,23 @@ braid(f::FusionTree{I,N}, levels::NTuple{N,Int}, p::NTuple{N,Int}) where {I<:Sec
6396
permute(f::FusionTree{I,N}, p::NTuple{N,Int}) where {I<:Sector,N}
6497
```
6598

66-
These can be composed to manipulate fusion-splitting tree pairs, for which the following
67-
methods are defined:
99+
These can be composed to implement elementary manipulations of fusion-splitting tree pairs,
100+
according to the following methods
101+
102+
```julia
103+
# TODO: add documentation for the following methods
104+
TensorKit.bendright
105+
TensorKit.bendleft
106+
TensorKit.foldright
107+
TensorKit.foldleft
108+
TensorKit.cycleclockwise
109+
TensorKit.cycleanticlockwise
110+
```
68111

112+
Finally, these are used to define large manipulations of fusion-splitting tree pairs, which
113+
are then used in the index manipulation of `AbstractTensorMap` objects. The following methods
114+
defined on fusion splitting tree pairs have an associated definition for tensors.
69115
```@docs
70-
bendright
71-
bendleft
72-
foldright
73-
foldleft
74-
cycleclockwise
75-
cycleanticlockwise
76116
repartition
77117
transpose(f₁::FusionTree{I}, f₂::FusionTree{I},
78118
p1::IndexTuple{N₁}, p2::IndexTuple{N₂}) where {I<:Sector,N₁,N₂}

docs/src/lib/spaces.md

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ CurrentModule = TensorKit
66

77
## Type hierarchy
88

9+
The following types are defined to characterise vector spaces and their properties:
10+
911
```@docs
1012
Field
1113
VectorSpace
@@ -19,21 +21,48 @@ ProductSpace
1921
HomSpace
2022
```
2123

24+
together with the following specific types for encoding the inner product structure of
25+
a space:
26+
27+
```@docs
28+
InnerProductStyle
29+
```
30+
2231
## Useful constants
32+
33+
The following constants are defined to easily create the concrete type of `GradedSpace`
34+
associated with a given type of sector.
35+
2336
```@docs
2437
Vect
2538
Rep
26-
ZNSpace{N}
27-
Z2Space
28-
Z3Space
29-
Z4Space
30-
U1Space
31-
SU2Space
32-
CU1Space
39+
```
40+
41+
In this respect, there are also a number of type aliases for the `GradedSpace` types
42+
associated with the most common sectors, namely
43+
44+
```julia
45+
const ZNSpace{N} = Vect[ZNIrrep{N}]
46+
const Z2Space = ZNSpace{2}
47+
const Z3Space = ZNSpace{3}
48+
const Z4Space = ZNSpace{4}
49+
const U1Space = Rep[U₁]
50+
const CU1Space = Rep[CU₁]
51+
const SU2Space = Rep[SU₂]
52+
53+
# Unicode alternatives
54+
const ℤ₂Space = Z2Space
55+
const ℤ₃Space = Z3Space
56+
const ℤ₄Space = Z4Space
57+
const U₁Space = U1Space
58+
const CU₁Space = CU1Space
59+
const SU₂Space = SU2Space
3360
```
3461

3562
## Methods
63+
3664
Methods often apply similar to e.g. spaces and corresponding tensors or tensor maps, e.g.:
65+
3766
```@docs
3867
field
3968
sectortype
@@ -42,33 +71,46 @@ hassector
4271
dim(::VectorSpace)
4372
dim(::ElementarySpace, ::Sector)
4473
dim(P::ProductSpace{<:ElementarySpace,N}, sector::NTuple{N,<:Sector}) where {N}
74+
dim(::HomSpace)
4575
dims
4676
blocksectors(::ProductSpace)
4777
blocksectors(::HomSpace)
78+
hasblock
4879
blockdim
80+
fusiontrees(::ProductSpace, ::Sector)
4981
space
5082
```
5183

5284
The following methods act specifically on `ElementarySpace` spaces:
85+
5386
```@docs
5487
isdual
5588
dual
5689
conj
5790
flip
58-
:
91+
5992
oneunit
6093
supremum
6194
infimum
6295
```
96+
6397
while the following also work on both `ElementarySpace` and `ProductSpace`
6498

6599
```@docs
100+
one(::VectorSpace)
66101
fuse
67-
:⊗
102+
⊗(::VectorSpace, ::VectorSpace)
68103
⊠(::VectorSpace, ::VectorSpace)
69-
one
70104
ismonomorphic
71105
isepimorphic
72106
isisomorphic
73107
insertunit
74108
```
109+
110+
There are also specific methods for `HomSpace` instances, that mimic the effect of that
111+
operation on the corresponding tensor maps:
112+
113+
```@docs
114+
permute(::HomSpace, ::Index2Tuple)
115+
compose(::HomSpace{S}, ::HomSpace{S}) where {S}
116+
```

0 commit comments

Comments
 (0)