mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-10-19 09:05:36 +02:00
Merge branch 'AutF4' of git.wmi.amu.edu.pl:kalmar/PropertyT.jl into AutF4
# Conflicts: # src/sdps.jl
This commit is contained in:
commit
f6383eed7e
@ -7,7 +7,6 @@ using Memento
|
|||||||
using Groups
|
using Groups
|
||||||
import Nemo: Group, GroupElem
|
import Nemo: Group, GroupElem
|
||||||
|
|
||||||
|
|
||||||
const logger = Memento.config("info", fmt="{msg}")
|
const logger = Memento.config("info", fmt="{msg}")
|
||||||
const solver_logger = Memento.config("info", fmt="{msg}")
|
const solver_logger = Memento.config("info", fmt="{msg}")
|
||||||
|
|
||||||
|
28
src/sdps.jl
28
src/sdps.jl
@ -1,29 +1,6 @@
|
|||||||
using JuMP
|
using JuMP
|
||||||
import MathProgBase: AbstractMathProgSolver
|
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))
|
function constraints_from_pm(pm, total_length=maximum(pm))
|
||||||
n = size(pm,1)
|
n = size(pm,1)
|
||||||
constraints = constraints = [Array{Int,1}[] for x in 1:total_length]
|
constraints = constraints = [Array{Int,1}[] for x in 1:total_length]
|
||||||
@ -36,11 +13,12 @@ function constraints_from_pm(pm, total_length=maximum(pm))
|
|||||||
return constraints
|
return constraints
|
||||||
end
|
end
|
||||||
|
|
||||||
function splaplacian(RG::GroupRing, S, Id=RG.group(), n=length(RG.basis))
|
function splaplacian(RG::GroupRing, S, Id=RG.group(),
|
||||||
|
n=length(RG.basis), T::Type=Int)
|
||||||
result = RG(spzeros(n))
|
result = RG(spzeros(n))
|
||||||
result[Id] = float(length(S))
|
result[Id] = float(length(S))
|
||||||
for s in S
|
for s in S
|
||||||
result[s] += -1.0
|
result[s] -= one(T)
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user