diff --git a/src/OrbitDecomposition.jl b/src/OrbitDecomposition.jl index ccfc503..16a3ded 100644 --- a/src/OrbitDecomposition.jl +++ b/src/OrbitDecomposition.jl @@ -79,14 +79,14 @@ function orbit_spvector(vect::AbstractVector, orbits) return orb_vector end -function orbit_constraint(constraints::Vector{Vector{Vector{Int64}}}, n) +function orbit_constraint(constraints::Vector{Vector{Tuple{Int,Int}}}, n) result = spzeros(n,n) for cnstr in constraints for p in cnstr - result[p[2], p[1]] += 1.0 + result[p[2], p[1]] += 1.0/length(constraints) end end - return 1/length(constraints)*result + return result end ############################################################################### diff --git a/src/PropertyT.jl b/src/PropertyT.jl index 2c2f7a4..32d4897 100644 --- a/src/PropertyT.jl +++ b/src/PropertyT.jl @@ -88,7 +88,7 @@ function ΔandSDPconstraints(prefix::String, G::Group) pm_fname, Δ_fname = pmΔfilenames(prefix) product_matrix = load(pm_fname, "pm") - sdp_constraints = constraints_from_pm(product_matrix) + sdp_constraints = constraints(product_matrix) RG = GroupRing(G, product_matrix) Δ = GroupRingElem(load(Δ_fname, "Δ")[:, 1], RG) @@ -107,15 +107,15 @@ end function ΔandSDPconstraints{T<:GroupElem}(S::Vector{T}, Id::T; radius::Int=2) info(logger, "Generating balls of sizes $sizes") - @logtime logger B, sizes = Groups.generate_balls(S, Id, radius=2*radius) + @logtime logger E_R, sizes = Groups.generate_balls(S, Id, radius=2*radius) info(logger, "Creating product matrix...") - @logtime logger pm = GroupRings.create_pm(B, GroupRings.reverse_dict(B), sizes[radius]; twisted=true) + @logtime logger pm = GroupRings.create_pm(E_R, GroupRings.reverse_dict(E_R), sizes[radius]; twisted=true) info(logger, "Creating sdp_constratints...") - @logtime logger sdp_constraints = PropertyT.constraints_from_pm(pm) + @logtime logger sdp_constraints = PropertyT.constraints(pm) - RG = GroupRing(parent(Id), B, pm) + RG = GroupRing(parent(Id), E_R, pm) Δ = splaplacian(RG, S) return Δ, sdp_constraints diff --git a/src/SDPs.jl b/src/SDPs.jl index 972f3b5..a12d166 100644 --- a/src/SDPs.jl +++ b/src/SDPs.jl @@ -1,13 +1,13 @@ using JuMP import MathProgBase: AbstractMathProgSolver -function constraints_from_pm(pm, total_length=maximum(pm)) +function constraints(pm, total_length=maximum(pm)) n = size(pm,1) - constraints = [Array{Int,1}[] for x in 1:total_length] + constraints = [Vector{Tuple{Int,Int}}() for _ in 1:total_length] for j in 1:n for i in 1:n idx = pm[i,j] - push!(constraints[idx], [i,j]) + push!(constraints[idx], (i,j)) end end return constraints