diff --git a/docs/make.jl b/docs/make.jl index 0474b13f..238f291b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -2,8 +2,7 @@ using Documenter using DocumenterVitepress using DocumenterCitations using Tenet -using CairoMakie -using GraphMakie +using Makie using LinearAlgebra DocMeta.setdocmeta!(Tenet, :DocTestSetup, :(using Tenet); recursive=true) diff --git a/docs/src/manual/ansatz/mps.md b/docs/src/manual/ansatz/mps.md index 91190139..4245bf83 100644 --- a/docs/src/manual/ansatz/mps.md +++ b/docs/src/manual/ansatz/mps.md @@ -1,33 +1,26 @@ # 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 Tenet +using GraphMakie 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 +using Tenet -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 +# Page(offline=true) +# WGLMakie.activate!() +CairoMakie.activate!(type = "svg") +Makie.inline!(true) +set_theme!(resolution=(800,200)) +``` -Label(fig[1,1, Bottom()], "Open") # hide -Label(fig[1,2, Bottom()], "Periodic") # hide +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). -fig # hide +```@example viz +tn = rand(MPS; n=10, maxdim=2) # hide +graphplot(tn; layout=Stress()) # hide ``` ## Matrix Product Operators (MPO) @@ -36,18 +29,8 @@ Matrix Product Operators (MPO) are the operator version of [Matrix Product State 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 +tn = rand(MPO, n=10, maxdim=2) # hide +graphplot(tn; layout=Stress()) # 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`). diff --git a/docs/src/manual/transformations.md b/docs/src/manual/transformations.md index 5a2c9788..49cb16bb 100644 --- a/docs/src/manual/transformations.md +++ b/docs/src/manual/transformations.md @@ -2,11 +2,14 @@ ```@setup plot using Makie -Makie.inline!(true) -using GraphMakie using CairoMakie -using Tenet +using GraphMakie using NetworkLayout +using Tenet + +CairoMakie.activate!(type = "svg") +Makie.inline!(true) +set_theme!(resolution=(800,200)) ``` In tensor network computations, it is good practice to apply various transformations to simplify the network structure, reduce computational cost, or prepare the network for further operations. These transformations modify the network's structure locally by permuting, contracting, factoring or truncating tensors. @@ -123,7 +126,7 @@ tn = TensorNetwork([ #hide reduced = transform(tn, Tenet.SplitSimplification) #hide graphplot!(fig[1, 1], tn; layout=Stress(), labels=true) #hide -graphplot!(fig[1, 2], reduced, layout=Spring(C=11); labels=true) #hide +graphplot!(fig[1, 2], reduced; layout=Spring(C=11), labels=true) #hide Label(fig[1, 1, Bottom()], "Original") #hide Label(fig[1, 2, Bottom()], "Transformed") #hide