Skip to content

Commit e8e3119

Browse files
committed
update docs
1 parent 081af8e commit e8e3119

1 file changed

Lines changed: 47 additions & 23 deletions

File tree

docs/src/man/states.md

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,53 @@ using LinearAlgebra: dot
88

99
## FiniteMPS
1010

11-
A [`FiniteMPS`](@ref) is - at its core - a chain of mps tensors.
11+
A [`FiniteMPS`](@ref) is - at its core - a chain of MPS tensors.
1212

1313
```@raw html
1414
<img src="../finite_mps_definition.png" alt="finite MPS" class="color-invertible"/>
1515
```
1616

17-
### Usage
17+
### Construction
1818

19-
A `FiniteMPS` can be created by passing in a vector of tensormaps:
19+
If you already have the state of interest, it is straightforward to convert it to an MPS as follows:
2020

2121
```@example states
22-
L = 10
23-
data = [rand(ComplexF64, ℂ^1 ⊗ ℂ^2 ← ℂ^1) for _ in 1:L];
24-
state = FiniteMPS(data)
22+
ψ_dense = rand((ℂ^2)^4)
23+
ψ_mps = FiniteMPS(ψ_dense)
2524
```
2625

27-
Or alternatively by specifying its structure
26+
However, typically this is not the case, as storing the full state becomes expensive rather quickly.
27+
Then, `FiniteMPS` are best constructed by first specifying a [`FiniteMPSManifold`](@ref) that encodes the physical and (maximal) virtual spaces:
2828

2929
```@example states
30-
max_bond_dimension = ℂ^4
31-
physical_space = ℂ^2
32-
state = FiniteMPS(rand, ComplexF64, L, physical_space, max_bond_dimension)
30+
pspaces = fill(ℂ^2, 10) # physical spaces (Vector)
31+
max_virtualspace = ℂ^4 # single max virtual space
32+
manifold = FiniteMPSManifold(pspaces, max_virtualspace)
33+
ψ = rand(manifold) # random normalized FiniteMPS
3334
```
3435

35-
You can take dot products, renormalize!, expectation values,....
36+
Finally, it is also possible to build them from explicit MPS tensors, by passing them directly.
37+
Here we construct the
38+
39+
```@example states
40+
As = [rand(ComplexF64, ℂ^1 ⊗ ℂ^2 ← ℂ^1) for _ in 1:L];
41+
ψ_from_As = FiniteMPS(As)
42+
```
43+
44+
!!! warning "Full rank spaces"
45+
46+
As the `FiniteMPS` object handles tensors in well-chosen gauges, the virtualspaces, as well as the associated tensors might reduce in size.
47+
This can be achieved in a lossless manner whenever the spaces are not full rank, in the following sense:
48+
```julia
49+
left_virtualspace(A) ⊗ physicalspace(A) ≿ right_virtualspace(A) &&
50+
left_virtualspace(A)' ≾ physicalspace(A) ⊗ right_virtualspace(A)'
51+
```
52+
53+
!!! warning "Edge spaces"
54+
55+
It is possible for a `FiniteMPS` object to have non-trivial left- and/or right edge spaces.
56+
This can be convenient whenever the state is embedded in a larger system (e.g. as part of a [`WindowMPS`](@ref)), or to allow for non-trivially charged symmetric states.
57+
Therefore, be mindful that when constructing a `FiniteMPS` from tensors directly, you need to handle the edges separately.
3658

3759
### Gauging and canonical forms
3860

@@ -102,25 +124,26 @@ The idea behind this construction is that one never has to worry about how the s
102124

103125
## InfiniteMPS
104126

105-
An [`InfiniteMPS`](@ref) can be thought of as being very similar to a finite mps, where the set of tensors is repeated periodically.
127+
An [`InfiniteMPS`](@ref) represents a periodically repeating unit cell of MPS tensors.
106128

107-
It can also be created by passing in a vector of `TensorMap`s:
129+
### Construction
130+
131+
Similar to `FiniteMPS`, the easiest way of constructing an `InfiniteMPS` is by specifying an [`InfiniteMPSManifold`](@ref) describing one unit cell:
108132

109133
```@example states
110-
data = [rand(ComplexF64, ℂ^4 ⊗ ℂ^2 ← ℂ^4) for _ in 1:2]
111-
state = InfiniteMPS(data)
134+
pspaces = [ℂ^2, ℂ^2] # 2-site unit cell
135+
vspaces = [ℂ^4, ℂ^5] # virtual space to the left of each site
136+
manifold = InfiniteMPSManifold(pspaces, vspaces)
137+
ψinf = rand(manifold)
112138
```
113139

114-
or by initializing it from given spaces
140+
Alternatively, we may also start from explicit site tensors:
115141

116142
```@example states
117-
phys_spaces = fill(ℂ^2, 2)
118-
virt_spaces = [ℂ^4, ℂ^5] # by convention to the right of a site
119-
state = InfiniteMPS(phys_spaces, virt_spaces)
143+
As = [rand(ComplexF64, imanifold[i]) for i in 1:length(imanifold)]
144+
ψinf2 = InfiniteMPS(As)
120145
```
121146

122-
Note that the code above creates an `InfiniteMPS` with a two-site unit cell, where the given virtual spaces are located to the right of their respective sites.
123-
124147
### Gauging and canonical forms
125148

126149
Much like for `FiniteMPS`, we can again query the gauged tensors `AL`, `AR`, `C` and `AC`.
@@ -142,8 +165,9 @@ It represents a window of mutable tensors (a finite MPS), embedded in an infinit
142165
It can therefore be created accordingly, ensuring that the edges match:
143166

144167
```@example states
145-
infinite_state = InfiniteMPS(ℂ^2, ℂ^4)
146-
finite_state = FiniteMPS(5, ℂ^2, ℂ^4; left=ℂ^4, right=ℂ^4)
168+
infinite_state = rand(InfiniteMPSManifold(ℂ^2, ℂ^4))
169+
finite_manifold = FiniteMPSManifold(fill(ℂ^2, 5), ℂ^4; left_virtualspace=ℂ^4, right_virtualspace=ℂ^4)
170+
finite_state = rand(ComplexF64, finite_manifold)
147171
window = WindowMPS(infinite_state, finite_state, infinite_state)
148172
```
149173

0 commit comments

Comments
 (0)