Skip to content

Commit

Permalink
yet another bug in multipartite local_bound
Browse files Browse the repository at this point in the history
  • Loading branch information
araujoms committed Jan 3, 2025
1 parent ba1ff4f commit 55961c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nonlocal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ end
function _local_bound_correlation_core(chunk, ins::NTuple{N,Int}, squareG::Array{T,2}; marg::Bool = true) where {T,N}
ia = ins[1]
score = typemin(T)
ind = Vector{Int8}(undef, sum(ins[2:N]) - N + 1)
ind = Vector{Int8}(undef, sum(ins[2:N]) - marg*(N-1))
digits!(ind, chunk[1] - 1; base = 2)
sumsizes = [1; cumsum(collect(ins[2:N]) .- marg) .+ 1]
prodsizes = ones(Int, N - 1)
Expand Down
6 changes: 6 additions & 0 deletions test/nonlocal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@
@test local_bound(fp1) local_bound(fp2)
@test local_bound(fc1) local_bound(fc2)
@test local_bound(fc1) local_bound(fp1)
bigfc1 = zeros(T, 5, 6)
@views bigfc1[2:5, 2:6] .= fc1
@test local_bound(fc1; marg = false) local_bound(bigfc1; marg = true)
fp1 = rand(T, 2, 2, 2, 3, 4, 5)
fp2 = permutedims(fp1, (3, 2, 1, 6, 5, 4))
fc1 = tensor_correlation(fp1)
fc2 = tensor_correlation(fp2)
@test local_bound(fp1) local_bound(fp2)
@test local_bound(fc1) local_bound(fc2)
@test local_bound(fc1) local_bound(fp1)
bigfc1 = zeros(T, 5, 6, 7)
@views bigfc1[2:5, 2:6, 2:7] .= fc1
@test local_bound(fc1; marg = false) local_bound(bigfc1; marg = true)
end

Random.seed!(1337)
Expand Down

0 comments on commit 55961c0

Please sign in to comment.