Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation improvements #226

Merged
merged 12 commits into from
Jan 16, 2025
33 changes: 33 additions & 0 deletions .github/workflows/DocumentationCleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Doc Preview Cleanup

on:
pull_request:
types: [closed]

# Ensure that only one "Doc Preview Cleanup" workflow is force pushing at a time
concurrency:
group: doc-preview-cleanup
cancel-in-progress: false

jobs:
doc-preview-cleanup:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Delete preview and history + push changes
run: |
if [ -d "${preview_dir}" ]; then
git config user.name "Documenter.jl"
git config user.email "[email protected]"
git rm -rf "${preview_dir}"
git commit -m "delete preview"
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
git push --force origin gh-pages-new:gh-pages
fi
env:
preview_dir: previews/PR${{ github.event.number }}
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.12.0"
[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
BlockTensorKit = "5f87ffc2-9cf1-4a46-8172-465d160bd8cd"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
FLoops = "cc61a311-1640-44b5-9fba-1b764f453329"
FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a"
FoldsThreads = "9c68100b-dfe1-47cf-94c8-95104e173443"
Expand All @@ -28,6 +29,7 @@ VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"
Accessors = "0.1"
Aqua = "0.8.9"
BlockTensorKit = "0.1.1"
DocStringExtensions = "0.9.3"
FLoops = "0.1, 0.2"
FastClosures = "0.3"
FoldsThreads = "0.1"
Expand Down
2 changes: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244"
DocumenterInterLinks = "d12716ef-a0f6-4df4-a9f1-a5a34e75c656"
KrylovKit = "0b1a1467-8014-51b9-945f-bf0ae24f4b77"
MPSKit = "bb1c41ca-d63c-52ed-829e-0820dda26502"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Expand Down
21 changes: 17 additions & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ end

using MPSKit
using Documenter
using DocumenterCitations
using DocumenterInterLinks

# examples
example_dir = joinpath(@__DIR__, "src", "examples")
classic_pages = map(readdir(joinpath(example_dir, "classic2d"))) do dir
return joinpath("examples", "classic2d", dir, "index.md")
Expand All @@ -18,6 +21,15 @@ quantum_pages = map(readdir(joinpath(example_dir, "quantum1d"))) do dir
return joinpath("examples", "quantum1d", dir, "index.md")
end

# bibliography
bibpath = joinpath(@__DIR__, "src", "assets", "mpskit.bib")
bib = CitationBibliography(bibpath; style=:authoryear)

# interlinks
links = InterLinks("TensorKit" => "https://jutho.github.io/TensorKit.jl/stable/",
"TensorOperations" => "https://jutho.github.io/TensorOperations.jl/stable/",
"KrylovKit" => "https://jutho.github.io/KrylovKit.jl/stable/")

# include MPSKit in all doctests
DocMeta.setdocmeta!(MPSKit, :DocTestSetup, :(using MPSKit, TensorKit); recursive=true)

Expand All @@ -26,7 +38,6 @@ mathengine = MathJax3(Dict(:loader => Dict("load" => ["[tex]/physics"]),
"tags" => "ams",
"packages" => ["base", "ams", "autoload", "physics"])))
makedocs(;
modules=[MPSKit],
sitename="MPSKit.jl",
format=Documenter.HTML(;
prettyurls=get(ENV, "CI", nothing) == "true",
Expand All @@ -41,7 +52,9 @@ makedocs(;
"man/parallelism.md",
"man/lattices.md"],
"Examples" => "examples/index.md",
"Library" => "lib/lib.md"],
warnonly=true)
"Library" => "lib/lib.md",
"References" => "references.md"],
checkdocs=:exports,
plugins=[bib, links])

deploydocs(; repo="github.com/QuantumKitHub/MPSKit.jl.git")
deploydocs(; repo="github.com/QuantumKitHub/MPSKit.jl.git", push_preview=true)
457 changes: 457 additions & 0 deletions docs/src/assets/mpskit.bib

Large diffs are not rendered by default.

20 changes: 0 additions & 20 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,23 +201,3 @@ not be fully documented yet. If you encounter any issues or have questions, plea
library's [issue tracker](https://github.com/QuantumKitHub/MPSKit.jl/issues) on the GitHub
repository and open a new issue.

## Publications using MPSKit

Below you can find a list of publications that have made use of MPSKit. If you have used
this package and wish to have your publication added to this list, please open a pull
request or an issue on the [GitHub repository](https://github.com/QuantumKitHub/MPSKit.jl/).

- R. Belyansky et al., *“High-Energy Collision of Quarks and Hadrons in the Schwinger Model: From Tensor Networks to Circuit QED,”* 2023, doi: 10.48550/ARXIV.2307.02522.
- L. Devos, L. Vanderstraeten, and F. Verstraete, *“Haldane gap in the SU(3) [3 0 0] Heisenberg chain,”* Phys. Rev. B, vol. 106, no. 15, p. 155103, Oct. 2022, doi: 10.1103/PhysRevB.106.155103.
- J. C. Halimeh, M. V. Damme, T. V. Zache, D. Banerjee, and P. Hauke, *“Achieving the quantum field theory limit in far-from-equilibrium quantum link models,”* Quantum, vol. 6, p. 878, Dec. 2022, doi: 10.22331/q-2022-12-19-878.
- J. C. Halimeh, D. Trapin, M. Van Damme, and M. Heyl, *“Local measures of dynamical quantum phase transitions,”* Phys. Rev. B, vol. 104, no. 7, p. 075130, Aug. 2021, doi: 10.1103/PhysRevB.104.075130.
- M. Hauru, M. Van Damme, and J. Haegeman, *“Riemannian optimization of isometric tensor networks,”* SciPost Physics, vol. 10, no. 2, p. 040, Feb. 2021, doi: 10.21468/SciPostPhys.10.2.040.
- M. Van Damme, R. Vanhove, J. Haegeman, F. Verstraete, and L. Vanderstraeten, *“Efficient matrix product state methods for extracting spectral information on rings and cylinders,”* Phys. Rev. B, vol. 104, no. 11, p. 115142, Sep. 2021, doi: 10.1103/PhysRevB.104.115142.
- M. Van Damme, T. V. Zache, D. Banerjee, P. Hauke, and J. C. Halimeh, *“Dynamical quantum phase transitions in spin-$S$ $\text{U}(1)$ quantum link models,”* Phys. Rev. B, vol. 106, no. 24, p. 245110, Dec. 2022, doi: 10.1103/PhysRevB.106.245110.
- E. L. Weerda and M. Rizzi, *“Fractional quantum Hall states with variational Projected Entangled-Pair States: a study of the bosonic Harper-Hofstadter model,”* 2023, doi: 10.48550/ARXIV.2309.12811.
- C. Yu and J.-W. Lee, *“Closing of the Haldane gap in a spin-1 XXZ chain,”* J. Korean Phys. Soc., vol. 79, no. 9, pp. 841–845, Nov. 2021, doi: 10.1007/s40042-021-00283-z.
- Y. Zhang, A. Hulsch, H.-C. Zhang, W. Tang, L. Wang, and H.-H. Tu, *“Universal Scaling of Klein Bottle Entropy near Conformal Critical Points,”* Phys. Rev. Lett., vol. 130, no. 15, p. 151602, Apr. 2023, doi: 10.1103/PhysRevLett.130.151602.
- 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.
https:/​/​doi.org/​10.1103/​PhysRevB.99.195132
- 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
- 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
91 changes: 2 additions & 89 deletions docs/src/lib/lib.md
Original file line number Diff line number Diff line change
@@ -1,92 +1,5 @@
# Library documentation

## [States](@id lib_states)
```@docs
FiniteMPS
InfiniteMPS
WindowMPS
MultilineMPS
```

## Operators
```@docs
AbstractMPO
MPO
MPOHamiltonian
```

## Environments
```@docs
MPSKit.AbstractMPSEnvironments
MPSKit.AbstractInfiniteEnvironments
MPSKit.InfiniteMPOEnvironments
MPSKit.InfiniteMPOHamiltonianEnvironments
MPSKit.FiniteEnvironments
MPSKit.IDMRGEnvironments
```

## Algorithms
```@docs
find_groundstate
timestep
leading_boundary
dynamicaldmrg
changebonds
excitations
approximate
```

### [Groundstate algorithms](@id lib_gs_alg)
```@docs
VUMPS
IDMRG1
IDMRG2
DMRG
DMRG2
GradientGrassmann
```

### [Time evolution algorithms](@id lib_time_alg)
```@docs
TDVP
TDVP2
TaylorCluster
WII
```

### [Leading boundary algorithms](@id lib_bound_alg)
```@docs
VUMPS
VOMPS
GradientGrassmann
```

### [Bond change algorithms](@id lib_bc_alg)
```@docs
OptimalExpand
RandExpand
VUMPSSvdCut
SvdCut
```

### [Excitations](@id lib_ex_alg)
```@docs
QuasiparticleAnsatz
FiniteExcited
```

## Utility
```@docs
left_virtualspace
right_virtualspace
physicalspace
add_util_leg
expectation_value
variance
entanglement_spectrum
entropy
transfer_spectrum
correlation_length
entanglementplot
transferplot
```@autodocs
Modules = [MPSKit]
```
4 changes: 2 additions & 2 deletions docs/src/man/intro.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Prerequisites

The following sections describe the prerequisites for using MPSKit. If you are already
familiar with the concepts of MPSKit and TensorKit, you can skip to the [Overview](@ref)
section.
familiar with the concepts of MPSKit and TensorKit, you can skip to the [Conventions](@ref)
sections.

## TensorKit

Expand Down
4 changes: 2 additions & 2 deletions docs/src/man/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

In analogy to how we can define matrix product states as a contraction of local tensors, a
similar construction exist for operators. To that end, a Matrix Product Operator (MPO) is
nothing more than a collection of local [`MPOTensor`](@ref) objects, contracted along a
nothing more than a collection of local [`MPOTensor`](@ref MPSKit.MPOTensor) objects, contracted along a
line. Again, we can distinguish between finite and infinite operators, with the latter being
represented by a periodic array of MPO tensors.

Expand All @@ -13,7 +13,7 @@ These objects can be created either directly from a vector of `MPOTensor`s, or s
a dense operator (a subtype of `AbstractTensorMap{S,N,N}`), which is then decomposed into a
product of local tensors.

![](mpo.svg)
![](../assets/mpo.svg)

```@setup operators
using TensorKit, MPSKit
Expand Down
67 changes: 67 additions & 0 deletions docs/src/references.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# References

## Publications using MPSKit

Below you can find a list of publications that have made use of MPSKit. If you have used
this package and wish to have your publication added to this list, please open a pull
request or an issue on the [GitHub repository](https://github.com/QuantumKitHub/MPSKit.jl/).

### 2025

```@bibliography
Pages = []
capponi2025
mortier2025
```
### 2024

```@bibliography
Pages = []
belyansky2024
crotti2024
rogerson2024
ueda2024
weerda2024
```

### 2023

```@bibliography
Pages = []
zhang2023
```

### 2022

```@bibliography
Pages = []
devos2022
halimeh2022
roose2022
vandamme2022
vanhove2022
```

### 2021

```@bibliography
Pages = []
halimeh2021
hauru2021
roose2021
vandamme2021
yu2021
```

### 2019

```@bibliography
Pages = []
roose2019
```

## Full list of references

```@bibliography
```

2 changes: 1 addition & 1 deletion examples/classic2d/1.hard-hexagon/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ println("F = $F\tS = $S\tξ = $ξ")
md"""
## The scaling hypothesis

The dominant eigenvector is of course only an approximation. The finite bond dimension enforces a finite correlation length, which effectively introduces a length scale in the system. This can be exploited to formulate a [scaling hypothesis](https://arxiv.org/pdf/0812.2903.pdf), which in turn allows to extract the central charge.
The dominant eigenvector is of course only an approximation. The finite bond dimension enforces a finite correlation length, which effectively introduces a length scale in the system. This can be exploited to formulate a [pollmann2009](@cite), which in turn allows to extract the central charge.

First we need to know the entropy and correlation length at a bunch of different bond dimensions. Our approach will be to re-use the previous approximated dominant eigenvector, and then expanding its bond dimension and re-running VUMPS.
According to the scaling hypothesis we should have ``S \propto \frac{c}{6} log(ξ)``. Therefore we should find ``c`` using
Expand Down
8 changes: 5 additions & 3 deletions src/MPSKit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ module MPSKit
using TensorKit
using TensorKit: BraidingTensor
using BlockTensorKit
using KrylovKit, OptimKit, FastClosures
using KrylovKit
using KrylovKit: KrylovAlgorithm
using OptimKit, FastClosures
using Base.Threads, FLoops, Transducers, FoldsThreads
using Base.Iterators
using RecipesBase
using VectorInterface
using Accessors
using HalfIntegers
import TupleTools as TT
using DocStringExtensions

using LinearAlgebra: diag, Diagonal
using LinearAlgebra: LinearAlgebra
Expand Down Expand Up @@ -62,8 +65,7 @@ export exact_diagonalization
export TransferMatrix
export transfer_left, transfer_right

# Abstract type defs
abstract type Algorithm end
include("algorithms/algorithm.jl")

# submodules
include("utility/dynamictols.jl")
Expand Down
22 changes: 22 additions & 0 deletions src/algorithms/algorithm.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""
$(TYPEDEF)

Abstract supertype for all algorithm structs.
These can be thought of as `NamedTuple`s that hold the settings for a given algorithm,
which can be used for dispatch.
Additionally, the constructors can be used to provide default values and input sanitation.
"""
abstract type Algorithm end

function Base.show(io::IO, ::MIME"text/plain", alg::Algorithm)
if get(io, :compact, false)
println(io, "$typeof(alg)(...)")
return nothing
end
println(io, typeof(alg), ":")
iocompact = IOContext(io, :compact => true)
for f in propertynames(alg)
println(iocompact, " * ", f, ": ", getproperty(alg, f))
end
return nothing
end
Loading
Loading