Skip to content

Commit 0e08554

Browse files
committed
address review comments
1 parent c83eca1 commit 0e08554

9 files changed

Lines changed: 67 additions & 62 deletions

File tree

docs/src/appendix/categories.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ justified.
668668
Before continuing, let us use some examples to sketch the relevance of the concept of fusion
669669
categories. As mentioned, the categories ``\mathbf{Vect}_𝕜`` and ``\mathbf{SVect}_𝕜`` have
670670
``I ≂ 𝕜`` as simple object. For ``\mathbf{Vect}``, this is the only simple object, i.e. any
671-
other vector space ``V`` over ``𝕜``, can be thought of as a direct sum over
671+
other vector space ``V`` over ``𝕜`` can be thought of as a direct sum over
672672
``N^V_I = \mathrm{dim}(V)`` multiple copies of ``𝕜``. In ``\mathbf{SVect}``, the object
673673
``J = 0 ⊕ 𝕜`` with ``J_0=0`` the zero dimensional space and ``J_1 ≂ 𝕜`` is another simple
674674
object. Clearly, there are no non-zero grading preserving morphisms between ``I`` and ``J``,
@@ -884,14 +884,15 @@ allows to conclude that
884884
``∑_ν [B^{ab}_c]^{ν}_{μ} \overline{[B^{ab}_c]^{ν}_{μ′}} = \delta_{μ,μ′}``, i.e. ``B^{ab}_c``
885885
is a unitary matrix. The same result follows for ``A^{ab}_c`` in analogue fashion.
886886

887-
!!! note In the context of fusion categories, one often resorts to the so-called *isotopic*
888-
normalization convention, where splitting tensors are normalized as
889-
``(X^{ab}_{c,μ})^† ∘ X^{ab}_{c′,\mu′} = \sqrt{\frac{d_a d_b}{d_c}} δ_{c,c′} δ_{μ,μ′} \mathrm{id}_c``.
890-
This kills some of the quantum dimensions in formulas like the ones above and essentially
891-
allows to rotate the graphical notation of splitting and fusion tensors (up to a unitary
892-
transformation). Nonetheless, for our implementation of tensors and manipulations thereof
893-
(in particular orthonormal factorizations such as the singular value decomposition), we find
894-
it more convenient to work with the original normalization convention.
887+
!!! note
888+
In the context of fusion categories, one often resorts to the so-called *isotopic*
889+
normalization convention, where splitting tensors are normalized as
890+
``(X^{ab}_{c,μ})^† ∘ X^{ab}_{c′,\mu′} = \sqrt{\frac{d_a d_b}{d_c}} δ_{c,c′} δ_{μ,μ′} \mathrm{id}_c``.
891+
This kills some of the quantum dimensions in formulas like the ones above and essentially
892+
allows to rotate the graphical notation of splitting and fusion tensors (up to a unitary
893+
transformation). Nonetheless, for our implementation of tensors and manipulations thereof
894+
(in particular orthonormal factorizations such as the singular value decomposition), we find
895+
it more convenient to work with the original normalization convention.
895896

896897
Let us again study in more detail the example ``\mathbf{Rep}_{\mathsf{G}}``. The quantum
897898
dimension ``d_a`` of an irrep ``a`` is just the normal vector space dimension (over ``𝕜``)

docs/src/lib/sectors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ TensorKitSectors.Dihedral
5454
TensorKitSectors.ProductGroup
5555
```
5656

57-
The following types are used to characterise different properties of the different types of
57+
The following types are used to characterize different properties of the different types of
5858
sectors:
5959

6060
```@docs

docs/src/lib/spaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ removeunit(::ProductSpace, ::Val{i}) where {i}
119119
```
120120

121121
There are also specific methods for `HomSpace` instances, that are used in determining the
122-
resuling `HomSpace` after applying certain tensor operations.
122+
resulting `HomSpace` after applying certain tensor operations.
123123

124124
```@docs
125125
flip(W::HomSpace{S}, I) where {S}

docs/src/lib/tensors.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Base.getindex(::AbstractTensorMap, ::FusionTree, ::FusionTree)
130130
Base.setindex!(::AbstractTensorMap, ::Any, ::FusionTree, ::FusionTree)
131131
```
132132

133-
For a tensor `t` with `FusionType(sectortype(t)) isa UniqueFusion`, fusion trees are
133+
For a tensor `t` with `FusionStyle(sectortype(t)) isa UniqueFusion`, fusion trees are
134134
completely determined by the outcoming sectors, and the data can be accessed in a more
135135
straightforward way:
136136
```@docs
@@ -157,24 +157,24 @@ Random.randexp!
157157
The operations that can be performed on an `AbstractTensorMap` can be organized into the
158158
following categories:
159159

160-
* *vector operations*: these do not change the `space` or index strucure of a tensor and can
160+
* *vector operations*: these do not change the `space` or index structure of a tensor and can
161161
be straightforwardly implemented on on the full data. All the methods described in
162162
[VectorInterface.jl](https://github.com/Jutho/VectorInterface.jl) are supported. For
163163
compatibility reasons, we also provide implementations for equivalent methods from
164164
LinearAlgebra.jl, such as `axpy!`, `axpby!`.
165165

166166
* *index manipulations*: these change (permute) the index structure of a tensor, which
167167
affects the data in a way that is fully determined by the categorical data of the
168-
`sectortype` of the tensor.
169-
168+
`sectortype` of the tensor .
169+
170170
* *(planar) contractions* and *(planar) traces* (i.e., contractions with identity tensors).
171171
Tensor contractions correspond to a combination of some index manipulations followed by a
172172
composition or multiplication of the tensors in their role as linear maps. Tensor
173-
contractions are however of such important and frequency that they require a dedicated
173+
contractions are however of such importance and frequency that they require a dedicated
174174
implementation.
175175

176-
* *tensor factorisations*, which relies on their identification of tensors with linear maps
177-
between tensor spaces. The factorisations are applied as ordinary matrix factorisations to
176+
* *tensor factorizations*, which relies on their identification of tensors with linear maps
177+
between tensor spaces. The factorizations are applied as ordinary matrix factorizations to
178178
the matrix blocks associated with the coupled charges.
179179

180180
### Index manipulations
@@ -222,7 +222,7 @@ contract!
222222

223223
## `TensorMap` factorizations
224224

225-
The factorisation methods are powered by
225+
The factorization methods are powered by
226226
[MatrixAlgebraKit.jl](https://github.com/QuantumKitHub/MatrixAlgebraKit.jl) and all follow
227227
the same strategy. The idea is that the `TensorMap` is interpreted as a linear map based on
228228
the current partition of indices between `domain` and `codomain`, and then the entire range

docs/src/man/fusiontrees.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,24 +398,25 @@ abelian groups, all irreps are one-dimensional.
398398

399399
Some examples:
400400
```@repl fusiontrees
401+
using LinearAlgebra # hide
401402
s = Irrep[SU₂](1/2)
402403
iter = fusiontrees((s, s, s, s), SU2Irrep(1))
403404
f = first(iter)
404405
convert(Array, f)
405406
406407
LinearAlgebra.I ≈ convert(Array, FusionTree((SU2Irrep(1/2),), SU2Irrep(1/2), (false,), ()))
407408
Z = adjoint(convert(Array, FusionTree((SU2Irrep(1/2),), SU2Irrep(1/2), (true,), ())))
408-
transpose(Z) ≈ frobeniusschur(SU2Irrep(1/2)) * Z
409+
transpose(Z) ≈ frobenius_schur_phase(SU2Irrep(1/2)) * Z
409410
410411
LinearAlgebra.I ≈ convert(Array, FusionTree((Irrep[SU₂](1),), Irrep[SU₂](1), (false,), ()))
411412
Z = adjoint(convert(Array, FusionTree((Irrep[SU₂](1),), Irrep[SU₂](1), (true,), ())))
412-
transpose(Z) ≈ frobeniusschur(Irrep[SU₂](1)) * Z
413+
transpose(Z) ≈ frobenius_schur_phase(Irrep[SU₂](1)) * Z
413414
414415
#check orthogonality
415416
for f1 in iter
416417
for f2 in iter
417418
dotproduct = dot(convert(Array, f1), convert(Array, f2))
418-
println("< $f1, $f2> = $dotproduct")
419+
println("<$f1, $f2> = $dotproduct")
419420
end
420421
end
421422
```

docs/src/man/gradedspaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct GradedSpace{I<:Sector, D} <: ElementarySpace
1414
end
1515
```
1616
Here, `D` is a type parameter to denote the data structure used to store the degeneracy or
17-
multiplicity dimensions ``n_a`` of the different sectors. For conviency, `Vect[I]` will
17+
multiplicity dimensions ``n_a`` of the different sectors. For convenience, `Vect[I]` will
1818
return the fully concrete type with `D` specified.
1919

2020
Note that, conventionally, a graded vector space is a space that has a natural direct sum

docs/src/man/intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ map ``W → V`` is often denoted as a rank 2 tensor in ``V ⊗ W^*``, where ``W^
5555
to the dual space of ``W``. This simple example introduces two new concepts.
5656

5757
1. Typical vector spaces can appear in the domain and codomain in different related forms,
58-
e.g. as normal space or dual space. In fact, the most generic case is that every vector
59-
space ``V`` has associated with it a
58+
e.g. as normal spaces or dual spaces. In fact, the most generic case is that every
59+
vector space ``V`` has associated with it a
6060
[dual space](https://en.wikipedia.org/wiki/Dual_space) ``V^*``, a
6161
[conjugate space](https://en.wikipedia.org/wiki/Complex_conjugate_vector_space)
6262
``\overline{V}`` and a conjugate dual space ``\overline{V}^*``. The four different

docs/src/man/spaces.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ abstract type VectorSpace end
1515
Technically speaking, this name does not capture the full generality that TensorKit.jl
1616
supports, as instances of subtypes of `VectorSpace` can encode general objects in linear
1717
monoidal categories, which are not necessarily vector spaces. However, in order not to make
18-
the remaining discussion to abstract or complicated, we will simply use the nomenclature of
18+
the remaining discussion too abstract or complicated, we will simply use the nomenclature of
1919
vector spaces. In particular, we define two abstract subtypes
2020
```julia
2121
abstract type ElementarySpace <: VectorSpace end

docs/src/man/tutorial.md

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ The most important objects in TensorKit.jl are tensors, which we now create with
1717
A = randn(ℝ^3 ⊗ ℝ^2 ⊗ ℝ^4)
1818
```
1919

20-
Note that we entered the tensor size not as plain dimensions, by specifying the vector space
21-
associated with these tensor indices, in this case `ℝ^n`, which can be obtained by typing
22-
`\bbR+TAB`. The tensor then lives in the tensor product of the different spaces, which we
23-
can obtain by typing `` (i.e. `\otimes+TAB`), although for simplicity also the usual
24-
multiplication sign `*` does the job. Note also that `A` is printed as an instance of a
25-
parametric type `TensorMap`, which we will discuss below and contains `Tensor`.
20+
Note that we entered the tensor size not as plain dimensions, but by specifying the vector
21+
space associated with these tensor indices, in this case `ℝ^n`, which can be obtained by
22+
typing `\bbR+TAB`. The tensor then lives in the tensor product of the different spaces,
23+
which we can obtain by typing `` (i.e. `\otimes+TAB`), although for simplicity also the
24+
usual multiplication sign `*` does the job. Note also that `A` is printed as an instance of
25+
a parametric type `TensorMap`, which we will discuss below and contains `Tensor`.
2626

2727
Let us briefly sidetrack into the nature of `ℝ^n`:
2828

@@ -35,8 +35,8 @@ supertype(ElementarySpace)
3535
```
3636

3737
i.e. `ℝ^n` can also be created without Unicode using the longer syntax `CartesianSpace(n)`.
38-
It is subtype of `ElementarySpace`, with a standard (Euclidean) inner product over the real
39-
numbers. Furthermore,
38+
It is a subtype of `ElementarySpace`, with a standard (Euclidean) inner product over the
39+
real numbers. Furthermore,
4040

4141
```@repl tutorial
4242
W = ℝ^3 ⊗ ℝ^2 ⊗ ℝ^4
@@ -57,7 +57,7 @@ B = randn(ℝ^3 * ℝ^2 * ℝ^4);
5757
C = 0.5*A + 2.5*B
5858
```
5959

60-
Given that they are behave as vectors, they also have a scalar product and norm, which they
60+
Given that they behave as vectors, they also have a scalar product and norm, which they
6161
inherit from the Euclidean inner product on the individual `ℝ^n` spaces:
6262

6363
```@repl tutorial
@@ -106,9 +106,11 @@ Finally, we can factorize a tensor, creating a bipartition of a subset of its in
106106
its complement. With a plain Julia `Array`, one would apply `permutedims` and `reshape` to
107107
cast the array into a matrix before applying e.g. the singular value decomposition. With
108108
TensorKit.jl, one just specifies which indices go to the left (rows) and right (columns)
109+
with a tuple of tuples, selecting the respective indices for either side.
109110

110111
```@repl tutorial
111-
U, S, Vd = tsvd(A, ((1,3), (2,)));
112+
A_matrix = permute(A, ((1, 3), (2,)));
113+
U, S, Vd = svd_compact(A_matrix);
112114
@tensor A′[a,b,c] := U[a,c,d] * S[d,e] * Vd[e,b];
113115
A ≈ A′
114116
U
@@ -155,11 +157,12 @@ space(M₃)
155157

156158
Note that for the construction of `M₁`, in accordance with how one specifies the dimensions
157159
of a matrix (e.g. `randn(4,3)`), the first space is the codomain and the second the domain.
158-
This is somewhat opposite to the general notation for a function `f:domain→codomain`, so
159-
that we also support this more mathemical notation, as illustrated in the construction of
160-
`M₂`. However, as this is confusing from the perspective of rows and columns, we also
161-
support the syntax `codomain ← domain` and actually use this as the default way of printing
162-
`HomSpace` instances.
160+
This is somewhat opposite to the general notation for a function
161+
``f : \text{domain} \rightarrow \text{codomain}``, so that we also support this more
162+
mathematical notation, as illustrated in the construction of `M₂`. However, as this is
163+
confusing from the perspective of rows and columns, we also support the syntax
164+
`codomain ← domain` and actually use this as the default way of printing `HomSpace`
165+
instances.
163166

164167
The 'matrix-vector' or 'matrix-matrix' product can be computed between any two `TensorMap`
165168
instances for which the domain of the first matches with the codomain of the second, e.g.
@@ -179,7 +182,7 @@ codomain(U)
179182
domain(U)
180183
space(U)
181184
U' * U # should be the identity on the corresponding domain = codomain
182-
U' * U ≈ one(U'*U)
185+
U' * U ≈ one(U' * U)
183186
P = U * U' # should be a projector
184187
P * P ≈ P
185188
```
@@ -197,9 +200,9 @@ codomain(A2)
197200
domain(A2)
198201
```
199202

200-
In fact, `tsvd(A, ((1, 3), (2,)))` is a shorthand for `tsvd(permute(A, ((1, 3), (2,))))`,
201-
where `tsvd(A::TensorMap)` will just compute the singular value decomposition according to
202-
the given codomain and domain of `A`.
203+
In fact, this was already what we used in `svd_compact(A_matrix)` to create the matricized
204+
tensor `A_matrix`, and where `svd_compact(A::AbstractTensorMap)` will just compute the
205+
singular value decomposition according to the given codomain and domain of `A`.
203206

204207
Note, finally, that the `@tensor` macro treats all indices at the same footing and thus does
205208
not distinguish between codomain and domain. The linear numbering is first all indices in
@@ -243,12 +246,12 @@ where `ℂ` is obtained as `\bbC+TAB` and we also have the non-Unicode alternati
243246

244247
```@repl tutorial
245248
B = randn(ℂ^3 * ℂ^2 * ℂ^4);
246-
C = im*A + (2.5 - 0.8im) * B
249+
C = im * A + (2.5 - 0.8im) * B
247250
scalarBA = dot(B, A)
248251
scalarAA = dot(A, A)
249252
normA² = norm(A)^2
250-
U, S, Vd = tsvd(A, ((1, 3), (2,)));
251-
@tensor A′[a,b,c] := U[a,c,d] * S[d,e] * Vd[e,b];
253+
U, S, Vd = svd_compact(permute(A, ((1, 3), (2,))));
254+
@tensor A′[a, b, c] := U[a, c, d] * S[d, e] * Vd[e, b];
252255
A′ ≈ A
253256
permute(A, ((1, 3), (2,))) ≈ U * S * Vd
254257
```
@@ -321,8 +324,8 @@ convert(Array, A)
321324

322325
Here, we create a 5-dimensional space `V1`, which has a three-dimensional subspace
323326
associated with charge 0 (the trivial irrep of ``ℤ₂``) and a two-dimensional subspace with
324-
charge 1 (the non-trivial irrep). Similar for `V2`, where both subspaces are one-
325-
dimensional. Representing the tensor as a dense `Array`, we see that it is zero in those
327+
charge 1 (the non-trivial irrep). Similar for `V2`, where both subspaces are
328+
one-dimensional. Representing the tensor as a dense `Array`, we see that it is zero in those
326329
regions where the charges don't add to zero (modulo 2). Of course, the `Tensor(Map)` type in
327330
TensorKit.jl won't store these zero blocks, and only stores the non-zero information, which
328331
we can recognize also in the full `Array` representation.
@@ -333,7 +336,7 @@ encountered in the previous examples.
333336
```@repl tutorial
334337
B = randn(V1' * V1 * V2);
335338
@tensor C[a,b] := A[a,c,d] * B[c,b,d]
336-
U, S, V = tsvd(A, ((1, 3), (2,)));
339+
U, S, V = svd_compact(permute(A, ((1, 3), (2,))));
337340
U' * U # should be the identity on the corresponding domain = codomain
338341
U' * U ≈ one(U'*U)
339342
P = U * U' # should be a projector
@@ -349,7 +352,7 @@ A = randn(V * V, V)
349352
dim(A)
350353
convert(Array, A)
351354
352-
V = Rep[U₁×ℤ₂]((0, 0) => 2, (1, 1) => 1, (-1, 0) => 1)
355+
V = Rep[U₁ × ℤ₂]((0, 0) => 2, (1, 1) => 1, (-1, 0) => 1)
353356
dim(V)
354357
A = randn(V * V, V)
355358
dim(A)
@@ -366,12 +369,12 @@ more general sectortypes `I` it can be constructed as `Vect[I]`. Furthermore, `
366369
synonyms, e.g.
367370

368371
```@repl tutorial
369-
Rep[U₁](0=>3, 1=>2, -1=>1) == U1Space(-1=>1, 1=>2, 0=>3)
370-
V = U₁Space(1=>2, 0=>3, -1=>1)
372+
Rep[U₁](0 => 3, 1 => 2, -1 => 1) == U1Space(-1 => 1, 1 => 2, 0 => 3)
373+
V = U₁Space(1 => 2, 0 => 3, -1 => 1)
371374
for s in sectors(V)
372375
@show s, dim(V, s)
373376
end
374-
U₁Space(-1=>1, 0=>3, 1=>2) == GradedSpace(Irrep[U₁](1)=>2, Irrep[U₁](0)=>3, Irrep[U₁](-1)=>1)
377+
U₁Space(-1 => 1, 0 => 3, 1 => 2) == GradedSpace(Irrep[U₁](1) => 2, Irrep[U₁](0) => 3, Irrep[U₁](-1) => 1)
375378
supertype(GradedSpace)
376379
```
377380

@@ -416,13 +419,13 @@ less obvious to recognize the dense blocks, as there are additional zeros and th
416419
the original tensor data do not match with those in the `Array`. The reason is of course
417420
that the original tensor data now needs to be transformed with a construction known as
418421
fusion trees, which are made up out of the Clebsch-Gordan coefficients of the group. Indeed,
419-
note that the non-zero blocks are also no longer labeled by a list of sectors, but by pairs
420-
of fusion trees. This will be explained further in the manual. However, the Clebsch-Gordan
421-
coefficients of the group are only needed to actually convert a tensor to an `Array`. For
422-
working with tensors with `SU₂Space` indices, e.g. contracting or factorizing them, the
423-
Clebsch-Gordan coefficients are never needed explicitly. Instead, recoupling relations are
424-
used to symbolically manipulate the basis of fusion trees, and this only requires what is
425-
known as the topological data of the group (or its representation theory).
422+
note that the non-zero subblocks are also no longer labeled by a list of sectors, but by
423+
pairs of fusion trees. This will be explained further in the manual. However, the
424+
Clebsch-Gordan coefficients of the group are only needed to actually convert a tensor to an
425+
`Array`. For working with tensors with `SU₂Space` indices, e.g. contracting or factorizing
426+
them, the Clebsch-Gordan coefficients are never needed explicitly. Instead, recoupling
427+
relations are used to symbolically manipulate the basis of fusion trees, and this only
428+
requires what is known as the topological data of the group (or its representation theory).
426429

427430
In fact, this formalism extends beyond the case of group representations on vector spaces,
428431
and can also deal with super vector spaces (to describe fermions) and more general (unitary)

0 commit comments

Comments
 (0)