From 359e317fd940a42ddeb2a5e5be3af3363c624bda Mon Sep 17 00:00:00 2001 From: Marek Kaluba Date: Tue, 27 Feb 2024 18:12:31 +0100 Subject: [PATCH] compute star before the main loop in constraint_matrix --- src/constraint_matrix.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/constraint_matrix.jl b/src/constraint_matrix.jl index 9c5d0a8..5ae28b4 100644 --- a/src/constraint_matrix.jl +++ b/src/constraint_matrix.jl @@ -177,16 +177,17 @@ function _constraints( ) cnstrs = [signed(eltype(mstr))[] for _ in 1:num_constraints] LI = LinearIndices(size(mstr)) + star_of = [mstr.basis[SA.star(mstr.basis[i])] for i in 1:size(mstr, 1)] for ci in CartesianIndices(size(mstr)) k = LI[ci] i, j = Tuple(ci) - a_star_b = mstr[-i, j] + a_star_b = mstr[star_of[i], j] push!(cnstrs[a_star_b], k) if augmented # (1-a)'(1-b) = 1 - a' - b + a'b push!(cnstrs[id], k) - a_star, b = mstr[-i, id], j + a_star, b = mstr[star_of[i], id], j push!(cnstrs[a_star], -k) push!(cnstrs[b], -k) end