-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* projectors in factor graph are 1-dimensional * clean up * new way of loading J and states * clean up * add ! in decode_projector * clean up * forma and clean up code * clean up more * formate code * clean up * add test full_pegasus * brodcast all_states * add instances and example for Lukasz * add benchmarks * correct a type * clean up * correct typo * simplify spectrum.jl * remove decode_projector * threaded spectrum works * clean up * clean up * add rudementary gpu brute force * clen up * rm commented functions * fix binary conversion * add sortperm (requires cuda from master) * compare energies * add my_digits * add new kernel (still does not work, but close) * something works * fix bits * should work but it does not * gnoj * fix indexing * improve stuff a bit but still :( * almost there * fix issues with Spectrum * works * check all states * all work * clean up * add more control over CUDA lauch * all tests pass * add specializiation for brute_force devices * clean up * clean up * clean up energy mess * clean up tests * clean up 2 * clean up benchmarks * clean factor.jl * introducing Pegasus geometry * clean up pegasus_lattice * towards new pegasus geometry * new indexing of pegasus lattice * clean up * add energy * fix up * energy in factor * fix energy * clean up * clean up * add comment * fix * ecv * energy fg to fix * add energy for factor graph * add energy * add energy * fix energy * add changes for 1.7 * add energy from factor graph * clean up energy * energy works * cleam up * clean up * simplify energy for fg * clean up energy * energy * fix energy for fg * clear types and add cluster_size for fg * test * start documenting code * start commenting code * fixing pegasus conventions * begin writing tests for numbering functions * begun rewriting code wrom python * tests for written functions * all main functions for numerate * add ref * clean up * clean up * add pegasus_lattice_masoud * add pegasus_lattice_tomek * early work on zephyr lattice * zephyr lattice (Z1) * started work on zephyr lattice boundary * clean up Z1 * horizontal spins in zephyr * zephyr_to_linear, linear_to_zephy * started work on lattice_5_tuple * zephyr lattice Z2 square * fix bug * zephyr lattice rotated works for z1 and z2 * clean up * add empty clusters in zephyr * add zephyr lattice * idea projectors * aa * correct syntax * add comments * add periodic lattice (PBCs) * pool of projectors * fg * energy * decode states in sampling * lp size * remove PoolOfProjectors * no CUDA * removed unnecessary functions * start working on a proper types propagation * clean up tests * restor tests * fix a bug * clean up - all test pass * add more tests * rearange code a bit * final clean up * add truncated factor graph * truncate factor graph another method * fix bug in truncate_factor_graph * fix export truncate_factor_graph * truncate_factor_graph partialsortperm * precise truncate * fix truncate factor * repaired test of renumerations * Truncate factor graph based on belief propagation * iterations as a parameter in BP * remove println * clean belief propagation * clean up BP * belief propagation * remove println * BP tests * truncate_factor_graph_2site_BP * fix the bug in BP * new BP * BP 2-site * rewrite update message, add tests * bp (pathological not working) * bp example * cleaning * clean bp * updatemessage * sparse * bp * separate truncation and BP * rm tol * truncate fg for zephyr * comment projectors * states_int in Spectrum * fix the bug in Spectrum, all tests pass * change types in matrix_to_integers * rename factor_graph to clustered_hamiltonian * add bond energy * try to move PoolOfProjectors * add CUDA * try to remove :pl, :pr * PoolOfProjectors in clustered_hamiltonian * add tests on projectors * final cleaning projectors * add types * splitting overly long lines * exception in states_int * add docs * docs * add docstrings * add $(TYPEDSIGNATURES) * split the lines * corrected the function names * clean up toml * added function for loading openGM images * WIP rmf * add the docs * rmf clustered hamiltonian v1.0 * add the docs * bugfix * fix the bug in RMF clustered hamiltonian * clean up cluster hamiltonian for RMF * change cl_h spectrum * added sizes for benchmark instances and allowed diagonal conections * fix the bug in reading h5 instances * add docs * add the docs * add png images * moved projectors.jl to SpinGlassTensors * moved tests * git push * added SpinGlassTensors to dependencies * removed projectors.jl * changed version to 1.0 * moved rank_reveal to SpinGlassTensors * save BP results to file * rewrite truncate_hamiltonian_2site_BP * clean up * correct test * fix versions, switch to Graphs from LightGraphs * reformat * fix ci, make * update CI workflow * remove tensor cast * add push run * fix test * update readme * move benchmarks to other repo * fix test * update compat --------- Co-authored-by: annamariadziubyna <[email protected]> Co-authored-by: bartekGardas <[email protected]> Co-authored-by: Łukasz Pawela <[email protected]> Co-authored-by: Marek Rams <[email protected]> Co-authored-by: annamariadziubyna <[email protected]>
- Loading branch information
1 parent
bec471d
commit fb35876
Showing
61 changed files
with
58,927 additions
and
1,031 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,41 @@ | ||
name: CI | ||
on: | ||
- push | ||
- pull_request | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
jobs: | ||
test: | ||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | ||
runs-on: ${{ matrix.os }} | ||
name: Julia ${{ matrix.version }} | ||
runs-on: [self-hosted,titan,gpu] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: | ||
- '1.9' | ||
- '1.10' | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
arch: | ||
- x64 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@v1 | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v2 | ||
with: | ||
version: ${{ matrix.version }} | ||
arch: ${{ matrix.arch }} | ||
- uses: julia-actions/julia-buildpkg@latest | ||
- uses: julia-actions/julia-runtest@latest | ||
env: | ||
JULIA_NUM_THREADS: 4 | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
# - uses: codecov/codecov-action@v1 | ||
# with: | ||
# file: lcov.info | ||
- uses: coverallsapp/github-action@master | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
path-to-lcov: lcov.info | ||
flag-name: job-${{ matrix.version }}-${{ matrix.os }}-${{ matrix.arch }} | ||
parallel: true | ||
|
||
flag-name: run-${{ matrix.version }} | ||
finish: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
runs-on: [self-hosted,titan] | ||
steps: | ||
- uses: coverallsapp/github-action@master | ||
- name: Close parallel build | ||
uses: coverallsapp/github-action@v1 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
parallel-finished: true | ||
carryforward: "run-1.9,run-1.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
name = "SpinGlassNetworks" | ||
uuid = "b7f6bd3e-55dc-4da6-96a9-ef9dbec6ac19" | ||
authors = ["Krzysztof Domino <[email protected]>", "Anna Maria Dziubyna <annamariadziubyna@gmail.com>", "Bartłomiej Gardas <[email protected]>", "Konrad Jałowiecki <[email protected]>", "Łukasz Pawela <[email protected]>", "Marek M. Rams <[email protected]>"] | ||
version = "0.3.2" | ||
authors = ["Anna Maria Dziubyna <[email protected]>", "Tomasz Śmierzchalski <smierzchalski.tomek@gmail.com>", "Bartłomiej Gardas <[email protected]>", "Konrad Jałowiecki <[email protected]>", "Łukasz Pawela <[email protected]>", "Marek M. Rams <[email protected]>"] | ||
version = "1.0.0" | ||
|
||
[deps] | ||
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" | ||
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" | ||
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" | ||
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" | ||
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f" | ||
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" | ||
LabelledGraphs = "605abd48-4d17-4660-b914-d4df33194460" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
MKL = "33e6dc65-8f57-5167-99aa-e5a354878fb2" | ||
MetaGraphs = "626554b9-1ddb-594c-aa3c-2596fe9399a5" | ||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | ||
SpinGlassTensors = "7584fc6a-5a23-4eeb-8277-827aab0146ea" | ||
|
||
[compat] | ||
CSV = "0.8 - 0.10" | ||
DocStringExtensions = "0.8" | ||
Graphs = "1.9" | ||
LabelledGraphs = "^0.4.4" | ||
MetaGraphs = "0.7.2" | ||
CSV = "0.8" | ||
CUDA = "4.4" | ||
DocStringExtensions = "0.9" | ||
Graphs = "1.9.0" | ||
HDF5 = "0.17" | ||
JLD2 = "0.4" | ||
LabelledGraphs = "0.4.4" | ||
MKL = "0.4.2" | ||
MetaGraphs = "0.7" | ||
SparseArrays = "1.9" | ||
SpinGlassTensors = "1" | ||
julia = "1.9, 1.10" | ||
|
||
[extras] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
[![Coverage Status](https://coveralls.io/repos/github/iitis/SpinGlassNetworks.jl/badge.svg?branch=master)](https://coveralls.io/github/iitis/SpinGlassNetworks.jl?branch=master) | ||
# SpinGlassNetworks.jl | ||
Part of SpinGlassPEPS package. It constitutes the basis for the preparation of tensors and operations on them. | ||
|
||
We don't expect the user to interact with this package, as it is more of a "back-end" type. Nevertheless, we provide API references should the need arise. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
using Documenter, SpinGlassNetworks | ||
|
||
_pages = [ | ||
"Introduction" => "index.md", | ||
"User guide" => "userguide.md", | ||
"API Reference" => "api.md" | ||
"Ising graph" => "ising.md", | ||
"Lattice geometries" => "lattice.md", | ||
"Clustered hamiltonian" => "clh.md", | ||
"Local dimensional reduction" => "bp.md", | ||
"API Reference for auxiliary functions" => "api.md", | ||
] | ||
|
||
# ============================ | ||
format = Documenter.HTML(edit_link = "master", | ||
prettyurls = get(ENV, "CI", nothing) == "true", | ||
) | ||
format = | ||
Documenter.HTML(edit_link = "master", prettyurls = get(ENV, "CI", nothing) == "true") | ||
|
||
# format = Documenter.LaTeX(platform="none") | ||
|
||
makedocs( | ||
sitename="SpinGlassNetworks.jl", | ||
sitename = "SpinGlassNetworks.jl", | ||
modules = [SpinGlassNetworks], | ||
pages = _pages, | ||
format = format | ||
) | ||
format = format, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,66 @@ | ||
# Library | ||
|
||
--- | ||
|
||
```@meta | ||
CurrentModule = SpinGlassNetworks | ||
``` | ||
|
||
## Ising Graphs | ||
|
||
```@docs | ||
ising_graph | ||
biases | ||
couplings | ||
cluster | ||
inter_cluster_edges | ||
prune | ||
rank_vec | ||
couplings | ||
``` | ||
|
||
## Factor Graphs | ||
## Clustered Hamiltonian | ||
```@docs | ||
split_into_clusters | ||
decode_clustered_hamiltonian_state | ||
rank_reveal | ||
energy | ||
energy_2site | ||
cluster_size | ||
bond_energy | ||
exact_cond_prob | ||
truncate_clustered_hamiltonian | ||
``` | ||
|
||
## Belief propagation | ||
```@docs | ||
factor_graph | ||
decode_factor_graph_state | ||
local_energy | ||
interaction_energy | ||
get_neighbors | ||
MergedEnergy | ||
update_message | ||
merge_vertices_cl_h | ||
projector | ||
SparseCSC | ||
``` | ||
|
||
## Auxiliary Functions | ||
## Projectors | ||
```@docs | ||
PoolOfProjectors | ||
get_projector! | ||
add_projector! | ||
empty! | ||
``` | ||
|
||
## Spectrum | ||
```@docs | ||
brute_force | ||
energy | ||
full_spectrum | ||
Spectrum | ||
matrix_to_integers | ||
gibbs_tensor | ||
rank_reveal | ||
super_square_lattice | ||
brute_force | ||
``` | ||
|
||
## Truncate | ||
```@docs | ||
truncate_clustered_hamiltonian_1site_BP | ||
truncate_clustered_hamiltonian_2site_energy | ||
select_numstate_best | ||
``` | ||
|
||
## Auxiliary Functions | ||
```@docs | ||
zephyr_to_linear | ||
load_openGM | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## Belief propagation | ||
|
||
Local dimensional reduction can be achieved by selectively choosing states in the clustered Hamiltonian that have the lowest local energy in the cluster. This approach aims to reduce the dimensionality of the problem by focusing on the most relevant and energetically favorable states. It can be done by truncation based on energy or truncation based on Loopy Belief Propagation. | ||
|
||
```@docs | ||
clustered_hamiltonian_2site | ||
belief_propagation | ||
truncate_clustered_hamiltonian_2site_BP | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Introduction | ||
A clustered Hamiltonian is a graphical representation that allows for a convenient and intuitive way to describe the structure of a network. | ||
|
||
The concept of a clustered Hamiltonian within `SpinGlassNetworks.jl` introduces a mechanism for organizing spins into desired geometries, facilitating a structured approach to modeling complex spin systems. Analogous to a standard factor graph, the clustered Hamiltonian involves nodes that represent tensors within the underlying network. The edges connecting these nodes in the clustered Hamiltonian correspond to the indices shared between the respective tensors in the tensor network. | ||
|
||
```@docs | ||
clustered_hamiltonian | ||
``` | ||
|
||
## Simple example | ||
|
||
```@example | ||
using SpinGlassNetworks | ||
# Prepare simple instance | ||
instance = "$(@__DIR__)/../../src/instances/square_diagonal/5x5/diagonal.txt" | ||
ig = ising_graph(instance) | ||
# Create clustered Hamiltonian | ||
cl_h = clustered_hamiltonian( | ||
ig, | ||
cluster_assignment_rule = super_square_lattice((5,5,4)) | ||
) | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Ising model | ||
|
||
The Ising model is a mathematical model used to describe the behavior of interacting particles, such as atoms or molecules, in a magnetic field. In the Ising model, each particle is represented as a binary variable $s_i$ that can take on the values of either +1 or -1. The total energy of the system is given by the Hamiltonian: | ||
|
||
$H = \sum_{(i,j) \in \mathcal{E}} J_{ij} s_i s_j + \sum_{i} h_i s_i$ | ||
|
||
where $J_{ij}$ is the coupling constant between particles $i$ and $j$, $h_i$ is the external magnetic field at particle $i$, and the sum is taken over all pairs of particles and all particles in the system $\mathcal{E}$, respectively. | ||
|
||
In `SpinGlassPEPS.jl` package, an Ising graph can be created using the command `ising_graph`. | ||
```@docs | ||
ising_graph | ||
``` | ||
|
||
## Simple example | ||
In this simple example below we show how to create Ising graph of a instance given as txt file in a format (i, j, Jij). The resulting graph has vertices corresponding to positions of spins in the system and edges defining coupling strength between spins. Each vertex contains information about local field. | ||
|
||
```@example | ||
using SpinGlassNetworks | ||
# Create Ising instance | ||
instance = "$(@__DIR__)/../../src/instances/square_diagonal/5x5/diagonal.txt" | ||
ig = ising_graph(instance) | ||
# View graph properties | ||
@show biases(ig), couplings(ig) | ||
``` |
Oops, something went wrong.
fb35876
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
fb35876
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/104567
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: