From f8bd06264f47e3c766a45882aba8db19ac2b4392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= Date: Fri, 3 Nov 2023 16:30:46 +0100 Subject: [PATCH] Init docs skeleton --- docs/Project.toml | 8 +++++ docs/make.jl | 26 +++++++++++++++++ docs/src/assets/youtube.css | 6 ++++ docs/src/index.md | 12 ++++++++ docs/src/mps.md | 58 +++++++++++++++++++++++++++++++++++++ docs/src/peps.md | 52 +++++++++++++++++++++++++++++++++ 6 files changed, 162 insertions(+) create mode 100644 docs/Project.toml create mode 100644 docs/make.jl create mode 100644 docs/src/assets/youtube.css create mode 100644 docs/src/index.md create mode 100644 docs/src/mps.md create mode 100644 docs/src/peps.md diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..343763c --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,8 @@ +[deps] +CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" +NetworkLayout = "46757867-2c16-5918-afeb-47bfcb05e46a" + +[compat] +Documenter = "1" diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..e879512 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,26 @@ +using Pkg +Pkg.activate(@__DIR__) +Pkg.develop(path = joinpath(@__DIR__, "..")) +Pkg.instantiate() + +using Documenter +using Qrochet + +DocMeta.setdocmeta!(Tenet, :DocTestSetup, :(using Qrochet); recursive = true) + +makedocs( + modules = [Qrochet], + sitename = "Tenet.jl", + authors = "Sergio Sánchez Ramírez and contributors", + pages = Any[ + "Home"=>"index.md", + "Matrix Product States (MPS)"=>"quantum/mps.md", + "Projected Entangled Pair States (PEPS)"=>"quantum/peps.md", + ], + format = Documenter.HTML(prettyurls = false, assets = ["assets/youtube.css"]), + plugins = [], + checkdocs = :exports, + warnonly = true, +) + +deploydocs(repo = "github.com/bsc-quantic/Qrochet.jl.git", devbranch = "master", push_preview = true) diff --git a/docs/src/assets/youtube.css b/docs/src/assets/youtube.css new file mode 100644 index 0000000..37d909a --- /dev/null +++ b/docs/src/assets/youtube.css @@ -0,0 +1,6 @@ +.youtube-video { + margin-left: auto; + margin-right: auto; + text-align: center; + height: 315px; +} \ No newline at end of file diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..c02ebb9 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,12 @@ +# Qrochet.jl + +!!! info "BSC-Quantic's Registry" + `Tenet` and some of its dependencies are located in our [own Julia registry](https://github.com/bsc-quantic/Registry). + In order to download `Tenet`, add our registry to your Julia installation by using the [Pkg mode](https://docs.julialang.org/en/v1/stdlib/REPL/#Pkg-mode) in a REPL session, + + ```julia + using Pkg + pkg"registry add https://github.com/bsc-quantic/Registry" + ``` + +`Qrochet` is a quantum tensor network library based on [`Tenet`](https://github.com/bsc-quantic/Tenet.jl). diff --git a/docs/src/mps.md b/docs/src/mps.md new file mode 100644 index 0000000..55eeb53 --- /dev/null +++ b/docs/src/mps.md @@ -0,0 +1,58 @@ +# Matrix Product States (MPS) + +Matrix Product States (MPS) are a Quantum Tensor Network ansatz whose tensors are laid out in a 1D chain. +Due to this, these networks are also known as _Tensor Trains_ in other mathematical fields. +Depending on the boundary conditions, the chains can be open or closed (i.e. periodic boundary conditions). + +```@setup viz +using Makie +Makie.inline!(true) +set_theme!(resolution=(800,200)) + +using CairoMakie + +using Qrochet +using NetworkLayout +``` + +```@example viz +fig = Figure() # hide + +tn_open = rand(MatrixProduct{State,Open}, n=10, χ=4) # hide +tn_periodic = rand(MatrixProduct{State,Periodic}, n=10, χ=4) # hide + +plot!(fig[1,1], tn_open, layout=Spring(iterations=1000, C=0.5, seed=100)) # hide +plot!(fig[1,2], tn_periodic, layout=Spring(iterations=1000, C=0.5, seed=100)) # hide + +Label(fig[1,1, Bottom()], "Open") # hide +Label(fig[1,2, Bottom()], "Periodic") # hide + +fig # hide +``` + +## Matrix Product Operators (MPO) + +Matrix Product Operators (MPO) are the operator version of [Matrix Product State (MPS)](#matrix-product-states-mps). +The major difference between them is that MPOs have 2 indices per site (1 input and 1 output) while MPSs only have 1 index per site (i.e. an output). + +```@example viz +fig = Figure() # hide + +tn_open = rand(MatrixProduct{Operator,Open}, n=10, χ=4) # hide +tn_periodic = rand(MatrixProduct{Operator,Periodic}, n=10, χ=4) # hide + +plot!(fig[1,1], tn_open, layout=Spring(iterations=1000, C=0.5, seed=100)) # hide +plot!(fig[1,2], tn_periodic, layout=Spring(iterations=1000, C=0.5, seed=100)) # hide + +Label(fig[1,1, Bottom()], "Open") # hide +Label(fig[1,2, Bottom()], "Periodic") # hide + +fig # hide +``` + +In `Tenet`, the generic `MatrixProduct` ansatz implements this topology. Type variables are used to address their functionality (`State` or `Operator`) and their boundary conditions (`Open` or `Periodic`). + +```@docs +MatrixProduct +MatrixProduct(::Any) +``` diff --git a/docs/src/peps.md b/docs/src/peps.md new file mode 100644 index 0000000..e7adb38 --- /dev/null +++ b/docs/src/peps.md @@ -0,0 +1,52 @@ +# Projected Entangled Pair States (PEPS) + +Projected Entangled Pair States (PEPS) are a Quantum Tensor Network ansatz whose tensors are laid out in a 2D lattice. Depending on the boundary conditions, the chains can be open or closed (i.e. periodic boundary conditions). + +```@setup viz +using Makie +Makie.inline!(true) +set_theme!(resolution=(800,400)) + +using CairoMakie +CairoMakie.activate!(type = "svg") + +using Qrochet +using NetworkLayout +``` + +```@example viz +fig = Figure() # hide + +tn_open = rand(PEPS{Open}, rows=10, cols=10, χ=4) # hide +tn_periodic = rand(PEPS{Periodic}, rows=10, cols=10, χ=4) # hide + +plot!(fig[1,1], tn_open, layout=Stress(seed=1)) # hide +plot!(fig[1,2], tn_periodic, layout=Stress(seed=10,dim=2,iterations=100000)) # hide + +Label(fig[1,1, Bottom()], "Open") # hide +Label(fig[1,2, Bottom()], "Periodic") # hide + +fig # hide +``` + +## Projected Entangled Pair Operators (PEPO) + +```@example viz +fig = Figure() # hide + +tn_open = rand(PEPO{Open}, rows=10, cols=10, χ=4) # hide +tn_periodic = rand(PEPO{Periodic}, rows=10, cols=10, χ=4) # hide + +plot!(fig[1,1], tn_open, layout=Stress(seed=1)) # hide +plot!(fig[1,2], tn_periodic, layout=Stress(seed=10,dim=2,iterations=100000)) # hide + +Label(fig[1,1, Bottom()], "Open") # hide +Label(fig[1,2, Bottom()], "Periodic") # hide + +fig # hide +``` + +```@docs +ProjectedEntangledPair +ProjectedEntangledPair(::Any) +```