Skip to content

Commit dbe4733

Browse files
committed
Temporary fix for docs
1 parent 9c26ce4 commit dbe4733

File tree

6 files changed

+39
-79
lines changed

6 files changed

+39
-79
lines changed

docs/Project.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
33
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
44
MPSKit = "bb1c41ca-d63c-52ed-829e-0820dda26502"
5-
MPSKitModels = "ca635005-6f8c-4cd1-b51d-8491250ef2ab"
65
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
76
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
87
Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

docs/src/index.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ operators and models.
3737
using TensorOperations
3838
using TensorKit
3939
using MPSKit
40-
using MPSKitModels
4140
using LinearAlgebra: norm
4241
```
4342

@@ -48,7 +47,6 @@ using LinearAlgebra
4847
using TensorOperations
4948
using TensorKit
5049
using MPSKit
51-
using MPSKitModels
5250
```
5351

5452
Finite MPS are characterised by a set of tensors, one for each site, which each have 3 legs.
@@ -106,10 +104,16 @@ Using the pre-defined models in `MPSKitModels`, we can construct the groundstate
106104
transverse field Ising model:
107105

108106
```@example finitemps
109-
H = transverse_field_ising(; J=1.0, g=0.5)
107+
J = 1.0
108+
g = 0.5
109+
lattice = fill(ComplexSpace(2), 10)
110+
X = TensorMap(ComplexF64[0 1; 1 0], ComplexSpace(2), ComplexSpace(2))
111+
Z = TensorMap(ComplexF64[1 0; 0 -1], space(X))
112+
H = FiniteMPOHamiltonian(lattice, (i, i+1) => -J * X ⊗ X for i in 1:length(lattice)-1) +
113+
FiniteMPOHamiltonian(lattice, (i,) => - g * Z for i in 1:length(lattice))
110114
find_groundstate!(mps, H, DMRG(; maxiter=10))
111115
E0 = expectation_value(mps, H)
112-
println("<mps|H|mps> = $(sum(real(E0)) / length(mps))")
116+
println("<mps|H|mps> = $real(E0)")
113117
```
114118

115119
### Infinite Matrix Product States
@@ -119,7 +123,6 @@ using LinearAlgebra
119123
using TensorOperations
120124
using TensorKit
121125
using MPSKit
122-
using MPSKitModels
123126
```
124127

125128
Similarly, an infinite MPS can be constructed by specifying the tensors for the unit cell,
@@ -173,11 +176,16 @@ println("<mps|𝕀₁|mps> = $N2")
173176
observable computed from the MPS would either blow up to infinity or vanish to zero.
174177

175178
Finally, the MPS can be optimized in order to determine groundstates of given Hamiltonians.
176-
Using the pre-defined models in `MPSKitModels`, we can construct the groundstate for the
177-
transverse field Ising model:
179+
There are plenty of pre-defined models in `MPSKitModels`, but we can also manually construct
180+
the groundstate for the transverse field Ising model:
178181

179182
```@example infinitemps
180-
H = transverse_field_ising(; J=1.0, g=0.5)
183+
J = 1.0
184+
g = 0.5
185+
lattice = PeriodicVector([ComplexSpace(2)])
186+
X = TensorMap(ComplexF64[0 1; 1 0], ComplexSpace(2), ComplexSpace(2))
187+
Z = TensorMap(ComplexF64[1 0; 0 -1], space(X))
188+
H = InfiniteMPOHamiltonian(lattice, (1, 2) => -J * X ⊗ X, (1,) => - g * Z)
181189
mps, = find_groundstate(mps, H, VUMPS(; maxiter=10))
182190
E0 = expectation_value(mps, H)
183191
println("<mps|H|mps> = $(sum(real(E0)) / length(mps))")
@@ -212,4 +220,4 @@ request or an issue on the [GitHub repository](https://github.com/QuantumKitHub/
212220
- Gertian Roose, Laurens Vanderstraeten, Jutho Haegeman, and Nick Bultinck. Anomalous domain wall condensation in a modified ising chain. Phys. Rev. B, 99: 195132, May 2019. 10.1103/​PhysRevB.99.195132.
213221
https:/​/​doi.org/​10.1103/​PhysRevB.99.195132
214222
- Roose, G., Bultinck, N., Vanderstraeten, L. et al. Lattice regularisation and entanglement structure of the Gross-Neveu model. J. High Energ. Phys. 2021, 207 (2021). https://doi.org/10.1007/JHEP07(2021)207
215-
- Roose, G., Haegeman, J., Van Acoleyen, K. et al. The chiral Gross-Neveu model on the lattice via a Landau-forbidden phase transition. J. High Energ. Phys. 2022, 19 (2022). https://doi.org/10.1007/JHEP06(2022)019
223+
- Roose, G., Haegeman, J., Van Acoleyen, K. et al. The chiral Gross-Neveu model on the lattice via a Landau-forbidden phase transition. J. High Energ. Phys. 2022, 19 (2022). https://doi.org/10.1007/JHEP06(2022)019

docs/src/lib/lib.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ MPSMultiline
1212
```@docs
1313
AbstractMPO
1414
MPO
15-
FiniteMPO
16-
InfiniteMPO
1715
MPOHamiltonian
18-
FiniteMPOHamiltonian
19-
InfiniteMPOHamiltonian
20-
SparseMPO
21-
DenseMPO
2216
```
2317

2418
## Environments
@@ -31,23 +25,6 @@ MPSKit.FiniteEnvironments
3125
MPSKit.IDMRGEnvironments
3226
```
3327

34-
## Generic actions
35-
```@docs
36-
∂C
37-
∂∂C
38-
∂AC
39-
∂∂AC
40-
∂AC2
41-
∂∂AC2
42-
43-
c_proj
44-
ac_proj
45-
ac2_proj
46-
47-
transfer_left
48-
transfer_right
49-
```
50-
5128
## Algorithms
5229
```@docs
5330
find_groundstate

docs/src/man/algorithms.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
```@meta
2-
DocTestSetup = quote
3-
using MPSKit, MPSKitModels, TensorKit
4-
end
2+
DocTestSetup = :( using MPSKit, TensorKit)
53
```
64

75
# [Algorithms](@id um_algorithms)
@@ -168,7 +166,9 @@ in the transverse field Ising model, we calculate the first excited state as sho
168166
provided code snippet, amd check the accuracy against theoretical values. Some deviations
169167
are expected, both due to finite-bond-dimension and finite-size effects.
170168

171-
```jldoctest; output = false
169+
<!-- TODO: reenable doctest -->
170+
171+
```julia
172172
# Model parameters
173173
g = 10.0
174174
L = 16
@@ -194,7 +194,9 @@ in the unit cell in a plane-wave superposition, requiring momentum specification
194194
[Haldane gap](https://iopscience.iop.org/article/10.1088/0953-8984/1/19/001) computation in
195195
the Heisenberg model illustrates this approach.
196196

197-
```jldoctest; output = false
197+
<!-- TODO: reenable doctest -->
198+
199+
```julia
198200
# Setting up the model and momentum
199201
momentum = π
200202
H = heisenberg_XXX()
@@ -219,7 +221,9 @@ trivial total charge. However, quasiparticles with different charges can be obta
219221
the sector keyword. For instance, in the transverse field Ising model, we consider an
220222
excitation built up of flipping a single spin, aligning with `Z2Irrep(1)`.
221223

222-
```jldoctest; output = false
224+
<!-- TODO: reenable doctest -->
225+
226+
```julia
223227
g = 10.0
224228
L = 16
225229
H = transverse_field_ising(Z2Irrep; g)
@@ -260,7 +264,9 @@ often referred to as the 'Chepiga ansatz', named after one of the authors of thi
260264

261265
This is supported via the following syntax:
262266

263-
```jldoctest
267+
<!-- TODO: reenable doctest -->
268+
269+
```julia
264270
g = 1.0
265271
L = 16
266272
H = transverse_field_ising(; g)
@@ -278,7 +284,9 @@ true
278284
In order to improve the accuracy, a two-site version also exists, which varies two
279285
neighbouring sites:
280286

281-
```jldoctest
287+
<!-- TODO: reenable doctest -->
288+
289+
```julia
282290
g = 1.0
283291
L = 16
284292
H = transverse_field_ising(; g)

docs/src/man/operators.md

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ h = 0.5
103103
chain = fill(ℂ^2, 3) # a finite chain of 4 sites, each with a 2-dimensional Hilbert space
104104
single_site_operators = [1 => -h * S_z, 2 => -h * S_z, 3 => -h * S_z]
105105
two_site_operators = [(1, 2) => -J * S_x ⊗ S_x, (2, 3) => -J * S_x ⊗ S_x]
106-
H_ising = FIniteMPOHamiltonian(chain, single_site_operators..., two_site_operators...);
106+
H_ising = FiniteMPOHamiltonian(chain, single_site_operators..., two_site_operators...);
107107
```
108108

109109
Various alternative constructions are possible, such as using a `Dict` with key-value pairs
@@ -229,9 +229,11 @@ general form, by supplying a 3-dimensional array $W$ to the constructor. Here, t
229229
dimension specifies the site in the unit cell, the second dimension specifies the row of the
230230
matrix, and the third dimension specifies the column of the matrix.
231231

232-
```@example operators
232+
<!-- TODO: reenable doctest -->
233+
234+
```julia
233235
data = Array{Any,3}(missing, 1, 3, 3) # missing is interpreted as zero
234-
data[1, 1, 1] = id(Matrix{ComplexF64}, ℂ^2)
236+
data[1, 1, 1] = id(ComplexF64, ℂ^2)
235237
data[1, 3, 3] = 1 # regular numbers are interpreted as identity operators
236238
data[1, 1, 2] = -J * S_x
237239
data[1, 2, 3] = S_x
@@ -263,34 +265,3 @@ a collection (direct sum) of spaces, one for each row/column.
263265

264266
<!-- TODO: add examples virtualspace once blocktensors are in place -->
265267

266-
## DenseMPO
267-
268-
This operator is used for statistical physics problems. It is simply a periodic array of mpo tensors.
269-
270-
Can be created using
271-
```julia
272-
DenseMPO(t::AbstractArray{T,1}) where T<:MPOTensor
273-
```
274-
275-
## SparseMPO
276-
277-
`SparseMPO` is similar to a `DenseMPO`, in that it again represents an mpo tensor, periodically repeated. However this type keeps track of all internal zero blocks, allowing for a more efficient representation of certain operators (such as time evolution operators and quantum hamiltonians). You can convert a sparse mpo to a densempo, but the converse does not hold.
278-
279-
280-
Indexing a `SparseMPO` returns a `SparseMPOSlice` object, which has 3 fields
281-
282-
```@docs
283-
MPSKit.SparseMPOSlice
284-
```
285-
286-
When indexing a `SparseMPOSlice` at index `[j, k]` (or equivalently `SparseMPO[i][j, k]`), the code looks up the corresponding field in `Os[j, k]`. Either that element is a tensormap, in which case it gets returned. If it equals `zero(E)`, then we return a tensormap
287-
```julia
288-
domspaces[j] * pspace pspace * imspaces[k]
289-
```
290-
with norm zero. If the element is a nonzero number, then implicitly we have the identity operator there (multiplied by that element).
291-
292-
The idea here is that you don't have to worry about the underlying structure, you can just index into a sparsempo as if it is a vector of matrices. Behind the scenes we then optimize certain contractions by using the sparsity structure.
293-
294-
SparseMPO are always assumed to be periodic in the first index (position).
295-
In this way, we can both represent periodic infinite mpos and place dependent finite mpos.
296-

src/algorithms/expval.jl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ acts, while the operator is either a `AbstractTensorMap` or a `FiniteMPO`.
1919
2020
# Examples
2121
```jldoctest
22-
julia> ψ = FiniteMPS(ones, Float64, 4, ℂ^2, ℂ^3);
22+
julia> ψ = FiniteMPS(ones(Float64, (ℂ^2)^4));
2323
2424
julia> S_x = TensorMap(Float64[0 1; 1 0], ℂ^2, ℂ^2);
2525
@@ -28,9 +28,6 @@ julia> round(expectation_value(ψ, 2 => S_x))
2828
2929
julia> round(expectation_value(ψ, (2, 3) => S_x ⊗ S_x))
3030
1.0
31-
32-
julia> round(expectation_value(ψ, MPOHamiltonian(S_x)))
33-
4.0
3431
```
3532
"""
3633
function expectation_value end

0 commit comments

Comments
 (0)