Skip to content

Commit 8a29479

Browse files
committed
tensor docs update
1 parent 0695066 commit 8a29479

2 files changed

Lines changed: 34 additions & 33 deletions

File tree

docs/src/man/sectors.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,9 +691,9 @@ As mentioned, the convenience mehtod `GradedSpace[I]` will return the concrete t
691691
concern. In fact, for consistency, `GradedSpace[Trivial]` will just return `ComplexSpace`,
692692
which is not even a specific type of `GradedSpace`. There is also the Unicode alias `ℂ[I]`,
693693
and for the specific case of group irreps as sectors, one can use `Rep[G]` with `G` the
694-
group, as inspired by the categorical name ``Rep_G``. Here, `Rep` is a `UnionAll` type that
695-
for `GradedSpace{I}` where `I` is either the `Irrep` of some group, or a `ProductSector` of
696-
`Irrep`s. Some illustrations:
694+
group, as inspired by the categorical name ``\mathbf{Rep}_{\mathsf{G}}``. Here, `Rep` is a
695+
`UnionAll` type that for `GradedSpace{I}` where `I` is either the `Irrep` of some group, or
696+
a `ProductSector` of `Irrep`s. Some illustrations:
697697
```@repl sectors
698698
ℂ[]
699699
ℂ[Trivial]

docs/src/man/tensors.md

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ below, can act directly on this matrix representation.
6666
properties and would thus not constitute the matrix representation of the tensor in a
6767
compatible basis.
6868

69-
Now consider the case where `sectortype(S) == G` for some `G` which has
70-
`FusionStyle(G) == Abelian()`, i.e. the representations of an Abelian group, e.g. `G == ℤ₂`
71-
or `G == U₁`. In this case, the tensor data is associated with sectors
72-
`(a1, a2, …, aN₁) ∈ sectors(V1 ⊗ V2 ⊗ … ⊗ VN₁)` and `(b1, …, bN₂) ∈ sectors(W1 ⊗ … ⊗ WN₂)`
73-
such that they fuse to a same common charge, i.e.
69+
Now consider the case where `sectortype(S) == I` for some `I` which has
70+
`FusionStyle(I) == Abelian()`, i.e. the representations of an Abelian group, e.g.
71+
`I == Irrep[ℤ₂]` or `I == Irrep[U₁]`. In this case, the tensor data is associated with
72+
sectors `(a1, a2, …, aN₁) ∈ sectors(V1 ⊗ V2 ⊗ … ⊗ VN₁)` and
73+
`(b1, …, bN₂) ∈ sectors(W1 ⊗ … ⊗ WN₂)` such that they fuse to a same common charge, i.e.
7474
`(c = first(⊗(a1, …, aN₁))) == first(⊗(b1, …, bN₂))`. The data associated with this takes
7575
the form of a multidimensional array with size
76-
`(dim(V1, a1), …, dim(VN₁, aN₁), dim(W1, b1), …, dim(WN₂, bN₂))`, or equivalently, a
77-
matrix of with row size `dim(V1, a1)*…*dim(VN₁, aN₁) == dim(codomain, (a1, …, aN₁))` and
78-
column size `dim(W1, b1)*…*dim(WN₂, aN₂) == dim(domain, (b1, …, bN₂))`.
76+
`(dim(V1, a1), …, dim(VN₁, aN₁), dim(W1, b1), …, dim(WN₂, bN₂))`, or equivalently, a matrix
77+
of with row size `dim(V1, a1)*…*dim(VN₁, aN₁) == dim(codomain, (a1, …, aN₁))` and column
78+
size `dim(W1, b1)*…*dim(WN₂, aN₂) == dim(domain, (b1, …, bN₂))`.
7979

8080
However, there are multiple combinations of `(a1, …, aN₁)` giving rise to the same `c`, and
8181
so there is data associated with all of these, as well as all possible combinations of
@@ -114,7 +114,7 @@ the data in this `view` is not contiguous, because the stride between the differ
114114
is larger than the length of the columns. Nonetheless, this does not pose a problem and even
115115
as multidimensional array there is still a definite stride associated with each dimension.
116116

117-
When `FusionStyle(G) isa NonAbelian`, things become slightly more complicated. Not only do
117+
When `FusionStyle(I) isa NonAbelian`, things become slightly more complicated. Not only do
118118
`(a1, …, aN₁)` give rise to different coupled sectors `c`, there can be multiply ways in
119119
which they fuse to `c`. These different possibilities are enumerated by the iterator
120120
`fusiontrees((a1, …, aN₁), c)` and `fusiontrees((b1, …, bN₂), c)`, and with each of those,
@@ -137,7 +137,7 @@ unitary basis transform which makes this matrix representation block diagonal, m
137137
specifically, of the form ``⨁_{c} B_c ⊗ 𝟙_{c}``, where ``B_c`` denotes `block(t,c)` and
138138
``𝟙_{c}`` is an identity matrix of size `(dim(c), dim(c))`. The reason for this extra
139139
identity is that the group representation is recoupled to act as ``⨁_{c} 𝟙 ⊗ u_c(g)`` for
140-
all ``g ∈ \mathsf{G}``, with ``u_c(g)`` the matrix representation of group element ``g``
140+
all ``g ∈ \mathsf{I}``, with ``u_c(g)`` the matrix representation of group element ``g``
141141
according to the irrep ``c``. In the abelian case, `dim(c) == 1`, i.e. all irreducible
142142
representations are one-dimensional and Schur's lemma only dictates that all off-diagonal
143143
blocks are zero. However, in this case the basis transform to the block diagonal
@@ -302,15 +302,15 @@ without and with symmetry. In the former case, one can pass a `DenseArray`, eith
302302
rank `N₁+N₂` and with matching size `(dims(codomain)..., dims(domain)...)`, or just as a
303303
`DenseMatrix` with size `(dim(codomain), dim(domain))`. In the case of symmetry, `data`
304304
needs to be specified as a dictionary (some subtype of `AbstractDict`) with the
305-
blocksectors `c::G <: Sector` as keys and the corresponding matrix blocks as value, i.e.
305+
blocksectors `c::I <: Sector` as keys and the corresponding matrix blocks as value, i.e.
306306
`data[c]` is some `DenseMatrix` of size `(blockdim(codomain, c), blockdim(domain, c))`.
307307

308308
```@repl tensors
309309
data = randn(3,3,3)
310310
t = TensorMap(data, ℂ^3 ⊗ ℂ^3, ℂ^3)
311311
t ≈ TensorMap(reshape(data, (9, 3)), ℂ^3 ⊗ ℂ^3, ℂ^3)
312312
V = ℤ₂Space(0=>2, 1=>2)
313-
data = Dict(ℤ₂(0)=>randn(8,2), ℤ₂(1)=>randn(8,2))
313+
data = Dict(Z2Irrep(0)=>randn(8,2), Z2Irrep(1)=>randn(8,2))
314314
t2 = TensorMap(data, V*V, V)
315315
for (c,b) in blocks(t2)
316316
println("Data for block $c :")
@@ -373,8 +373,8 @@ V2 = ℤ₂Space(0=>2,1=>1)
373373
m = TensorMap(randn, V1, V2)
374374
convert(Array, m) |> disp
375375
# compare with:
376-
block(m, ℤ₂(0)) |> disp
377-
block(m, ℤ₂(1)) |> disp
376+
block(m, Irrep[ℤ₂](0)) |> disp
377+
block(m, Irrep[ℤ₂](1)) |> disp
378378
# Now a `TensorMap{ℤ₂Space, 2, 2}`
379379
t = TensorMap(randn, V1 ⊗ V1, V2 ⊗ V2')
380380
(array = convert(Array, t)) |> disp
@@ -386,8 +386,8 @@ d2 = dim(domain(t))
386386
u'*u ≈ I ≈ v'*v
387387
(u'*matrix*v) |> disp
388388
# compare with:
389-
block(t, ℤ₂(0)) |> disp
390-
block(t, ℤ₂(1)) |> disp
389+
block(t, Z2Irrep(0)) |> disp
390+
block(t, Z2Irrep(1)) |> disp
391391
```
392392
Here, we illustrated some additional concepts. Firstly, note that we convert a `TensorMap`
393393
to an `Array`. This only works when `sectortype(t)` supports `fusiontensor`, and in
@@ -402,20 +402,20 @@ and `N₂`. Here, we use the operation `fuse(V)`, which creates an `ElementarySp
402402
isomorphic to a given space `V` (of type `ProductSpace` or `ElementarySpace`). The specific
403403
map between those two spaces constructed using the specific method `unitary` implements
404404
precisely the basis change from the product basis to the coupled basis. In this case, for a
405-
group `G` with `FusionStyle(G) isa Abelian`, it is a permutation matrix. Specifically
405+
group `G` with `FusionStyle(Irrep[G]) isa Abelian`, it is a permutation matrix. Specifically
406406
choosing `V` equal to the codomain and domain of `t`, we can construct the explicit basis
407407
transforms that bring `t` into block diagonal form.
408408

409-
Let's repeat the same exercise for `G = SU₂`, which has `FusionStyle(G) isa NonAbelian`.
409+
Let's repeat the same exercise for `I = Irrep[SU₂]`, which has `FusionStyle(I) isa NonAbelian`.
410410
```@repl tensors
411411
V1 = SU₂Space(0=>2,1=>1)
412412
V2 = SU₂Space(0=>1,1=>1)
413413
# First a `TensorMap{SU₂Space, 1, 1}`
414414
m = TensorMap(randn, V1, V2)
415415
convert(Array, m) |> disp
416416
# compare with:
417-
block(m, SU₂(0)) |> disp
418-
block(m, SU₂(1)) |> disp
417+
block(m, Irrep[SU₂](0)) |> disp
418+
block(m, Irrep[SU₂](1)) |> disp
419419
# Now a `TensorMap{SU₂Space, 2, 2}`
420420
t = TensorMap(randn, V1 ⊗ V1, V2 ⊗ V2')
421421
(array = convert(Array, t)) |> disp
@@ -427,14 +427,15 @@ d2 = dim(domain(t))
427427
u'*u ≈ I ≈ v'*v
428428
(u'*matrix*v) |> disp
429429
# compare with:
430-
block(t, SU₂(0)) |> disp
431-
block(t, SU₂(1)) |> disp
432-
block(t, SU₂(2)) |> disp
430+
block(t, SU2Irrep(0)) |> disp
431+
block(t, SU2Irrep(1)) |> disp
432+
block(t, SU2Irrep(2)) |> disp
433433
```
434434
Note that the basis transforms `u` and `v` are no longer permutation matrices, but are
435435
still unitary. Furthermore, note that they render the tensor block diagonal, but that now
436436
every element of the diagonal blocks labeled by `c` comes itself in a tensor product with
437-
an identity matrix of size `dim(c)`, i.e. `dim(SU₂(1)) = 3` and `dim(SU₂(2)) = 5`.
437+
an identity matrix of size `dim(c)`, i.e. `dim(SU2Irrep(1)) = 3` and
438+
`dim(SU2Irrep(2)) = 5`.
438439

439440
## [Tensor properties](@id ss_tensor_properties)
440441

@@ -701,7 +702,7 @@ indices simultaneously can be obtained by using the defining property
701702

702703
but is currently not implemented explicitly.
703704

704-
For all sector types `G` with `BraidingStyle(G) == Bosonic()`, all twists are `1` and thus
705+
For all sector types `I` with `BraidingStyle(I) == Bosonic()`, all twists are `1` and thus
705706
have no effect. Let us start with some examples, in which we illustrate that, albeit
706707
`permute` might act highly non-trivial on the fusion trees and on the corresponding data,
707708
after conversion to a regular `Array` (when possible), it just acts like `permutedims`
@@ -736,8 +737,8 @@ product. This might be very confusing, and as such we leave tensor conjugation u
736737
However, note that we have a conjugation syntax within the context of
737738
[tensor contractions](@ref ss_tensor_contraction).
738739

739-
To show the effect of `twist`, we now consider a type of sector `G` for which
740-
`BraidingStyle{G} != Bosonic()`. In particular, we use `FibonacciAnyon`. We cannot convert
740+
To show the effect of `twist`, we now consider a type of sector `I` for which
741+
`BraidingStyle{I} != Bosonic()`. In particular, we use `FibonacciAnyon`. We cannot convert
741742
the resulting `TensorMap` to an `Array`, so we have to rely on indirect tests to verify our
742743
results.
743744

@@ -990,7 +991,7 @@ R ≈ W'*S*W
990991
U2, S2, W2, ε = tsvd(t; trunc = truncspace(V1));
991992
W2*W2' ≈ id(codomain(W2))
992993
S2
993-
ε ≈ norm(block(S, SU₂(1)))*sqrt(dim(SU₂(1)))
994+
ε ≈ norm(block(S, Irrep[SU₂](1)))*sqrt(dim(Irrep[SU₂](1)))
994995
995996
L, Q = rightorth(t, (1,), (2,3));
996997
codomain(L), domain(L), domain(Q)
@@ -1020,7 +1021,7 @@ two-dimensional diagram cannot easily be encoded in a single line of code.
10201021

10211022
However, things simplify when the braiding is symmetric (such that over- and under-
10221023
crossings become equivalent, i.e. just crossings), and when twists, i.e. self-crossings in
1023-
this case, are trivial. This amounts to `BraidingStyle(G) == Bosonic()` in the language of
1024+
this case, are trivial. This amounts to `BraidingStyle(I) == Bosonic()` in the language of
10241025
TensorKit.jl, and is true for any subcategory of ``\mathbf{Vect}``, i.e. ordinary tensors,
10251026
possibly with some symmetry constraint. The case of ``\mathbf{SVect}`` and its
10261027
subcategories, and more general categories, are discussed below.
@@ -1044,7 +1045,7 @@ Hence, we can now specify such a tensor diagram, henceforth called a tensor cont
10441045
also tensor network, using a one-dimensional syntax that mimicks
10451046
[abstract index notation](https://en.wikipedia.org/wiki/Abstract_index_notation)
10461047
and specifies which indices are connected by the evaluation map using Einstein's summation
1047-
conventation. Indeed, for `BraidingStyle(G) == Bosonic()`, such a tensor contraction can
1048+
conventation. Indeed, for `BraidingStyle(I) == Bosonic()`, such a tensor contraction can
10481049
take the same format as if all tensors were just multi-dimensional arrays. For this, we
10491050
rely on the interface provided by the package
10501051
[TensorOperations.jl](https://github.com/Jutho/TensorOperations.jl).

0 commit comments

Comments
 (0)