Skip to content

Commit

Permalink
Merge branch 'master' into master_to_be
Browse files Browse the repository at this point in the history
  • Loading branch information
lpawela committed Apr 9, 2024
2 parents 330ebbd + bec471d commit b7220f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ising.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function unique_nodes(ising_tuples)
end

"""
$(TYPEDSIGNATURES)
ising_graph(instance, sgn::Number = 1.0, rank_override::Dict{Int,Int} = Dict{Int,Int}())
Create an Ising graph from interaction data.
Expand Down
2 changes: 1 addition & 1 deletion src/spectrum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function matrix_to_integers(matrix::Vector{Vector{T}}) where {T}
end

"""
$(TYPEDSIGNATURES)
energy(σ::Vector, ig::IsingGraph)
Calculates the energy of a state in an Ising graph.
Expand Down
5 changes: 5 additions & 0 deletions test/ising.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ end
@testset "Ising graph created with additional parameters" begin
expected_biases = [-0.1, -0.5, 0.0]
expected_couplings = Dict(Edge(1, 2) => 0.3, Edge(1, 3) => 2.0, Edge(2, 3) => -1.0)
expected_couplings = Dict(Edge(1, 2) => 0.3, Edge(1, 3) => 2.0, Edge(2, 3) => -1.0)
expected_J_matrix = [
[0 0.3 2.0]
[0 0 -1.0]
[0 0 0]
[0 0.3 2.0]
[0 0 -1.0]
[0 0 0]
]

ig = ising_graph(
Expand Down Expand Up @@ -112,6 +116,7 @@ end
@testset "Reading from Dict" begin
instance_dict = Dict()
ising = CSV.File(instance, types = [Int, Int, Float64], header = 0, comment = "#")
ising = CSV.File(instance, types = [Int, Int, Float64], header = 0, comment = "#")

for (i, j, v) ising
push!(instance_dict, (i, j) => v)
Expand Down

0 comments on commit b7220f0

Please sign in to comment.