Skip to content

Commit

Permalink
add newest version
Browse files Browse the repository at this point in the history
  • Loading branch information
annamariadziubyna committed Dec 19, 2023
1 parent 4afa39e commit cc28cd1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 69 deletions.
4 changes: 3 additions & 1 deletion docs/src/algorithm.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ H(\underline{x}_{\bar{N}}) = \sum_{\langle m,n\rangle \in \mathcal{F}} E_{x_m x_
where $\mathcal{F}$ forms a 2D graph, in which we indicate nearest-neighbour interactions with blue lines, and diagonal connections with green lines in the picture above.
Each $x_n$ takes $d$ values with $d=2^4$ for square diagonal, $d=2^{24}$ for Pegasus and $2^{16}$ for Zephyr geometry.
$E_{x_n}$ is an intra-node energy of the corresponding binary-variables configuration, and $E_{x_n x_m}$ is inter-node energy.

```@raw html
<img src="../images/clustering.pdf" width="200%" class="center"/>
```
## Calculating conditional probabilities
We assume that finding low energy states is equivalent to finding most probable states.
We represent the probability distribution as a PEPS tensor network.
Expand Down
Binary file added docs/src/images/geometry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 1 addition & 63 deletions docs/src/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,7 @@
Before providing the documentation of the offered functionality, it is good to demonstrate exactly what the package does.

## Basic example
In this example, we demonstrate how to use the `SpinGlassPEPS.jl` package to obtain a low-energy spectrum for a spin glass Hamiltonian defined on a square lattice with diagonal interactions on 100 spins. Let's look at an entire, working code that will do this calculation then discuss the main steps.

```@julia
using SpinGlassEngine, SpinGlassTensors, SpinGlassNetworks, SpinGlassPEPS
using SpinGlassExhaustive
using Logging
using LightGraphs
using LinearAlgebra
using TensorCast
using MetaGraphs
using Statistics
instance = "$(@__DIR__)/../src/instances/square_diagonal/5x5/diagonal.txt"
# size of network, m - number of columns, n - number of rows, t - number of spins in cluster
m, n, t = 5, 5, 4
onGPU = true # calculations on GPU (true) or on CPU (false)
β = 1.0 # inverse temperature
# Search parameters
δp = 0 # The cutoff probability for terminating the search
num_states = 20 # The maximum number of states to be considered during the search
# MpsParameters
bond_dim = 12 # Bond dimension
max_num_sweeps = 10 # Maximal number of sweeps during variational compression
tol_var = 1E-16 # The tolerance for the variational solver used in MPS optimization
tol_svd = 1E-16 # The tolerance used in singular value decomposition (SVD)
iters_svd = 2 # The number of iterations to perform in SVD computations
iters_var = 1 # The number of iterations for variational optimization
dtemp_mult = 2 # A multiplier for the bond dimension
method = :psvd_sparse # The SVD method to use
# Contraction parameters and methods
graduate_truncation = :graduate_truncate # Gradually truncates MPS
Strategy = Zipper # Strategy to optimize MPS
transform = rotation(0) # Transformation of the lattice
Layout = GaugesEnergy # Way of decomposition of the network into MPS
Sparsity = Sparse # Use sparse mode, when tensors are large
# Store parameters in structures
params = MpsParameters(bond_dim, tol_var, max_num_sweeps,
tol_svd, iters_svd, iters_var, dtemp_mult, method)
search_params = SearchParameters(num_states, δp)
# Create Ising graph
ig = ising_graph(instance)
# Create clustered Hamiltonian
cl_h = clustered_hamiltonian(
ig,
spectrum = full_spectrum,
cluster_assignment_rule=super_square_lattice((m, n, t))
)
# Build tensor network
net = PEPSNetwork{SquareCrossSingleNode{Layout}, Sparsity}(m, n, cl_h, transform)
ctr = MpsContractor{Strategy, NoUpdate}(net, [β], graduate_truncation, params; onGPU=onGPU)
# Solve using branch and bound search
sol_peps, s = low_energy_spectrum(ctr, search_params, merge_branches(ctr))
```

## Steps of the code
In this example, we demonstrate how to use the `SpinGlassPEPS.jl` package to obtain a low-energy spectrum for a spin glass Hamiltonian defined on a square lattice with diagonal interactions on 100 spins. Let's discuss the main steps of the code.

The first line
```@julia
Expand Down
Binary file added docs/src/sge/images/geometry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 25 additions & 5 deletions docs/src/sge/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@ Our package offers users the flexibility to choose between three distinct method
* `Zipper`
* `MPSAnnealing`
* `SVDTruncate`.

`Zipper` method combines randomized truncated Singular Value Decomposition (SVD) and a variational scheme.
```@raw html
<img src="../images/zipper.pdf" width="200%" class="center"/>
```
With the `SVDTruncate` method, the Matrix Product State (MPS) is systematically constructed row by row, contracted with the Matrix Product Operator (MPO) from the preceding row. The resulting MPS undergoes a Singular Value Decomposition (SVD) to truncate its bond dimension, followed by variational compression.
On the other hand, the `MPSAnnealing` method tailors the construction of MPS based on temperature considerations, with a subsequent variational compression step.
`Zipper` method combines randomized truncated Singular Value Decomposition (SVD) and a variational
scheme.
```@raw html
<img src="../images/svd_truncate.pdf" width="50%" class="center"/>
```
On the other hand, the `MPSAnnealing` method tailors the construction of MPS based on temperature considerations, with a subsequent variational compression step.
```@raw html
<img src="../images/annealing.pdf" width="50%" class="center"/>
```

# Sparsity
Our software package acknowledges the importance of two fundamental methodologies in tensor processing
Expand All @@ -30,22 +37,35 @@ Our software package acknowledges the importance of two fundamental methodologie
The latter, referred to as sparsity, plays a pivotal role in manipulation on large tensors. To accommodate this, our package offers the flexibility to choose the `Sparse` mode. In this mode, tensors are not explicitly constructed but are stored in structures and represented as blocks, in which not every dimension is contracted. This choice not only optimizes memory utilization but also significantly improves computational efficiency. In the `Dense` mode tensors are build explicitly.

# Geometry

* `SquareSingleNode`
```@raw html
<img src="../images/square_single.pdf" width="50%" class="center"/>
```
```@docs
SquareSingleNode
```

* `SquareDoubleNode`
```@raw html
<img src="../images/square_double.pdf" width="50%" class="center"/>
```
```@docs
SquareDoubleNode
```

* `SquareCrossSingleNode`
```@raw html
<img src="../images/square_cross_single.pdf" width="50%" class="center"/>
```
```@docs
SquareCrossSingleNode
```

* `SquareCrossDoubleNode`
```@raw html
<img src="../images/square_cross_double.pdf" width="50%" class="center"/>
```
```@docs
SquareCrossDoubleNode
```
Expand All @@ -64,7 +84,7 @@ For complex problems, the solution may depend on the choice of decomposition.
# Lattice transformations
Our package offers users the ability to undergo diverse transformations of PEPS network. Notably, users can apply `rotations`, occurring in multiples of $\frac{\pi}{2}$ radians, and `reflections` along various axes. These transformations include rotations and reflections around the horizontal (x), vertical (y), diagonal, and antidiagonal axes. Transformations are used to contract PEPS and perform search starting from different sites of the lattice.
```@raw html
<img src="../images/transform.pdf" width="200%" class="center"/>
<img src="../images/trans.pdf" width="200%" class="center"/>
```
```@docs
all_lattice_transformations
Expand Down

0 comments on commit cc28cd1

Please sign in to comment.