Update SL.jl to the newest GroupRings/PropertyT
This commit is contained in:
parent
dc9cd4c9ac
commit
86b8127322
77
SL.jl
77
SL.jl
@ -1,12 +1,11 @@
|
|||||||
using ArgParse
|
using ArgParse
|
||||||
using GroupAlgebras
|
|
||||||
using PropertyT
|
|
||||||
|
|
||||||
using Nemo
|
using Nemo
|
||||||
|
using GroupRings
|
||||||
|
using PropertyT
|
||||||
|
|
||||||
import SCS.SCSSolver
|
import SCS.SCSSolver
|
||||||
|
|
||||||
|
|
||||||
function E(i::Int, j::Int, M::Nemo.MatSpace)
|
function E(i::Int, j::Int, M::Nemo.MatSpace)
|
||||||
@assert i≠j
|
@assert i≠j
|
||||||
m = one(M)
|
m = one(M)
|
||||||
@ -19,8 +18,7 @@ function SL_generatingset(n::Int)
|
|||||||
G = Nemo.MatrixSpace(Nemo.ZZ, n,n)
|
G = Nemo.MatrixSpace(Nemo.ZZ, n,n)
|
||||||
S = [E(i,j,G) for (i,j) in indexing];
|
S = [E(i,j,G) for (i,j) in indexing];
|
||||||
S = vcat(S, [transpose(x) for x in S]);
|
S = vcat(S, [transpose(x) for x in S]);
|
||||||
S = vcat(S, [inv(x) for x in S]);
|
return unique(S)
|
||||||
return unique(S), one(G)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function SLsize(n,p)
|
function SLsize(n,p)
|
||||||
@ -34,37 +32,15 @@ end
|
|||||||
function SL_generatingset(n::Int, p::Int)
|
function SL_generatingset(n::Int, p::Int)
|
||||||
p == 0 && return SL_generatingset(n)
|
p == 0 && return SL_generatingset(n)
|
||||||
(p > 1 && n > 0) || throw(ArgumentError("Both n and p should be positive integers!"))
|
(p > 1 && n > 0) || throw(ArgumentError("Both n and p should be positive integers!"))
|
||||||
println("Size(SL(n,p)) = $(SLsize(n,p))")
|
println("Size(SL($n,$p)) = $(SLsize(n,p))")
|
||||||
F = Nemo.ResidueRing(Nemo.ZZ, p)
|
F = Nemo.ResidueRing(Nemo.ZZ, p)
|
||||||
G = Nemo.MatrixSpace(F, n,n)
|
G = Nemo.MatrixSpace(F, n,n)
|
||||||
indexing = [(i,j) for i in 1:n for j in 1:n if i≠j]
|
indexing = [(i,j) for i in 1:n for j in 1:n if i≠j]
|
||||||
S = [E(i, j, G) for (i,j) in indexing]
|
S = [E(i, j, G) for (i,j) in indexing]
|
||||||
S = vcat(S, [transpose(x) for x in S])
|
S = vcat(S, [transpose(x) for x in S])
|
||||||
S = vcat(S, [inv(s) for s in S])
|
return unique(S)
|
||||||
return unique(S), one(G)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ΔandSDPconstraints(Id, S, radius)
|
|
||||||
B, sizes = PropertyT.generate_balls(Id, S, radius=2*radius)
|
|
||||||
println("Generated balls of sizes $sizes")
|
|
||||||
basis = B[1:sizes[radius]]
|
|
||||||
|
|
||||||
product_matrix = PropertyT.create_product_matrix(B, sizes[radius]);
|
|
||||||
sdp_constraints = PropertyT.constraints_from_pm(product_matrix, length(B))
|
|
||||||
L_coeff = PropertyT.splaplacian_coeff(S, basis, length(B));
|
|
||||||
Δ = GroupAlgebraElement(L_coeff, product_matrix)
|
|
||||||
|
|
||||||
return Δ, sdp_constraints
|
|
||||||
end
|
|
||||||
|
|
||||||
#=
|
|
||||||
To use file property(T).jl (specifically: check_property_T function)
|
|
||||||
You need to define:
|
|
||||||
|
|
||||||
function ΔandSDPconstraints(identity, S):: (Δ, sdp_constraints)
|
|
||||||
|
|
||||||
=#
|
|
||||||
|
|
||||||
function cpuinfo_physicalcores()
|
function cpuinfo_physicalcores()
|
||||||
maxcore = -1
|
maxcore = -1
|
||||||
for line in eachline("/proc/cpuinfo")
|
for line in eachline("/proc/cpuinfo")
|
||||||
@ -107,7 +83,7 @@ function parse_commandline()
|
|||||||
"--radius"
|
"--radius"
|
||||||
help = "Find the decomposition over B_r(e,S)"
|
help = "Find the decomposition over B_r(e,S)"
|
||||||
arg_type = Int
|
arg_type = Int
|
||||||
default = 0
|
default = 2
|
||||||
end
|
end
|
||||||
|
|
||||||
return parse_args(s)
|
return parse_args(s)
|
||||||
@ -115,38 +91,45 @@ end
|
|||||||
|
|
||||||
function main()
|
function main()
|
||||||
|
|
||||||
|
|
||||||
parsed_args = parse_commandline()
|
parsed_args = parse_commandline()
|
||||||
|
if parsed_args["cpus"] ≠ nothing
|
||||||
|
if parsed_args["cpus"] > cpuinfo_physicalcores()
|
||||||
|
warn("Number of specified cores exceeds the physical core cound. Performance will suffer.")
|
||||||
|
end
|
||||||
|
Blas.set_num_threads(parsed_args["cpus"])
|
||||||
|
end
|
||||||
|
|
||||||
tol = parsed_args["tol"]
|
tol = parsed_args["tol"]
|
||||||
iterations = parsed_args["iterations"]
|
iterations = parsed_args["iterations"]
|
||||||
|
|
||||||
solver = SCSSolver(eps=tol, max_iters=iterations, verbose=true)
|
solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct)
|
||||||
|
|
||||||
N = parsed_args["N"]
|
N = parsed_args["N"]
|
||||||
upper_bound = parsed_args["upper-bound"]
|
upper_bound = parsed_args["upper-bound"]
|
||||||
p = parsed_args["p"]
|
p = parsed_args["p"]
|
||||||
|
|
||||||
if p == 0
|
if p == 0
|
||||||
name = "SL$(N)Z"
|
name = "SL$(N)Z"
|
||||||
else
|
else
|
||||||
name = "SL$(N)_$p"
|
name = "SL$(N)_$p"
|
||||||
end
|
end
|
||||||
radius = parsed_args["radius"]
|
|
||||||
if radius == 0
|
|
||||||
name = name*"-$(string(upper_bound))"
|
|
||||||
radius = 2
|
|
||||||
else
|
|
||||||
name = name*"-$(string(upper_bound))-r=$radius"
|
|
||||||
end
|
|
||||||
S() = SL_generatingset(N, p)
|
|
||||||
|
|
||||||
if parsed_args["cpus"] ≠ nothing
|
radius = parsed_args["radius"]
|
||||||
if parsed_args["cpus"] > cpuinfo_physicalcores()
|
|
||||||
warn("Number of specified cores exceeds the physical core cound. Performance will suffer.")
|
name = "$name_$iterations-$(string(upper_bound))-r=$radius"
|
||||||
end
|
|
||||||
Blas.set_num_threads(parsed_args["cpus"])
|
logger = PropertyT.setup_logging(name)
|
||||||
end
|
|
||||||
@time PropertyT.check_property_T(name, S, solver, upper_bound, tol, radius)
|
info(logger, "Group: $name")
|
||||||
|
info(logger, "Iterations: $iterations")
|
||||||
|
info(logger, "Precision: $tol")
|
||||||
|
info(logger, "Upper bound: $upper_bound")
|
||||||
|
|
||||||
|
S = SL_generatingset(N, p)
|
||||||
|
S = unique([S; [inv(s) for s in S]])
|
||||||
|
Id = one(parent(S[1]))
|
||||||
|
|
||||||
|
@time PropertyT.check_property_T(name, S, Id, solver, upper_bound, tol, radius)
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user