From 54da1d326c1a911868f1e7dd5192c32bed28c8cc Mon Sep 17 00:00:00 2001 From: kalmar Date: Tue, 6 Jun 2017 11:48:52 +0200 Subject: [PATCH 1/3] import Nemo: Group, GroupElem --- src/PropertyT.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PropertyT.jl b/src/PropertyT.jl index 7744b3b..a60015f 100644 --- a/src/PropertyT.jl +++ b/src/PropertyT.jl @@ -4,6 +4,8 @@ using JLD using GroupRings using Memento +import Nemo: Group, GroupElem + const logger = Memento.config("info", fmt="{msg}") const solver_logger = Memento.config("info", fmt="{msg}") From 4f14b0eff719e8fac9e3229e94b8eab641715d3b Mon Sep 17 00:00:00 2001 From: kalmar Date: Tue, 6 Jun 2017 11:50:26 +0200 Subject: [PATCH 2/3] remove old product_matrix code --- src/sdps.jl | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/sdps.jl b/src/sdps.jl index 834218a..49bd402 100644 --- a/src/sdps.jl +++ b/src/sdps.jl @@ -1,29 +1,6 @@ using JuMP import MathProgBase: AbstractMathProgSolver -function create_product_matrix{T}(basis::Vector{T}, limit; twisted=true) - product_matrix = zeros(Int, (limit,limit)) - basis_dict = Dict{T, Int}(x => i - for (i,x) in enumerate(basis)) - for i in 1:limit - if twisted - x = inv(basis[i]) - else - x = basis[i] - end - for j in 1:limit - w = x*basis[j] - product_matrix[i,j] = basis_dict[w] - # index = findfirst(basis, w) - # index ≠ 0 || throw(ArgumentError("Product is not supported on basis: $w")) - # product_matrix[i,j] = index - end - end - return product_matrix -end - -create_product_matrix{T}(basis::Vector{T}; twisted=twisted) = create_product_matrix(basis, length(basis); twisted=twisted) - function constraints_from_pm(pm, total_length=maximum(pm)) n = size(pm,1) constraints = constraints = [Array{Int,1}[] for x in 1:total_length] From aa0f0f3034fd520e5f3f459d6db6c90afda25eb1 Mon Sep 17 00:00:00 2001 From: kalmar Date: Tue, 6 Jun 2017 11:51:15 +0200 Subject: [PATCH 3/3] add type argument to splaplacian --- src/sdps.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdps.jl b/src/sdps.jl index 49bd402..365b960 100644 --- a/src/sdps.jl +++ b/src/sdps.jl @@ -13,11 +13,11 @@ function constraints_from_pm(pm, total_length=maximum(pm)) return constraints end -function splaplacian(RG::GroupRing, S, basis, n=length(basis)) - result = RG(spzeros(n)) - result[RG.group()] = float(length(S)) +function splaplacian(RG::GroupRing, S, basis, n=length(basis), T::Type=Int) + result = RG(spzeros(T, n)) + result[RG.group()] = T(length(S)) for s in S - result[s] += -1.0 + result[s] -= one(T) end return result end