Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
annamariadziubyna committed Apr 5, 2021
1 parent 0842dfa commit 182f027
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/ising.jl
Expand Up @@ -68,10 +68,32 @@ function ising_graph(
ig
end

"""
$(TYPEDSIGNATURES)
Returns an Array with nodes of graph.
"""
nodes(ig::MetaGraph) = collect(get_prop.(Ref(ig), vertices(ig), :node))

"""
$(TYPEDSIGNATURES)
Returns an Array with ranks of graph.
"""
rank_vec(ig::MetaGraph) = collect(values(get_prop(ig, :rank)))

"""
$(TYPEDSIGNATURES)
Returns size of graph's basis.
"""
basis_size(ig::MetaGraph) = prod(prod(rank_vec(ig)))

"""
$(TYPEDSIGNATURES)
Creates cluster of ising graph induced by vertices verts.
"""
function cluster(ig::MetaGraph, verts)
sub_ig, vmap = induced_subgraph(ig, collect(verts))

Expand Down
13 changes: 12 additions & 1 deletion src/lattice.jl
@@ -1,6 +1,11 @@
export super_square_lattice

function super_square_lattice(size::NTuple{5, Int})
"""
$(TYPEDSIGNATURES)
Creates square lattice used eg. as an assignment rule.
"""
function super_square_lattice(size::NTuple{5, Int})
m, um, n, un, t = size
new = LinearIndices((1:n, 1:m))
old = LinearIndices((1:t, 1:un, 1:n, 1:um, 1:m))
Expand All @@ -11,6 +16,12 @@ export super_square_lattice
)
end


"""
$(TYPEDSIGNATURES)
Creates square lattice used eg. as an assignment rule.
"""
function super_square_lattice(size::NTuple{3, Int})
m, n, t = size
super_square_lattice((m, 1, n, 1, t))
Expand Down
11 changes: 11 additions & 0 deletions src/spectrum.jl
Expand Up @@ -62,6 +62,17 @@ function brute_force(ig::MetaGraph; sorted=true, num_states::Int=1)
end
end

"""
$(TYPEDSIGNATURES)
Return the low energy spectrum
# Details
Calculates \$k\$ lowest energy states
together with the coresponding energies
of a classical Ising Hamiltonian
"""
full_spectrum(ig::MetaGraph; num_states::Int=1) = brute_force(ig, sorted=false, num_states=num_states)

struct Spectrum
Expand Down

0 comments on commit 182f027

Please sign in to comment.