Move grouptheoretic stuff to AutFNs module
This commit is contained in:
parent
1bbeca08f4
commit
25fef54e7d
138
AutFN_orbit.jl
138
AutFN_orbit.jl
@ -1,62 +1,4 @@
|
||||
using ArgParse
|
||||
using SCS
|
||||
# using Mosek
|
||||
|
||||
using Nemo
|
||||
if VERSION >= v"0.6.0"
|
||||
import Nemo.Generic.perm
|
||||
end
|
||||
|
||||
addprocs(4)
|
||||
using PropertyT
|
||||
|
||||
using Groups
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Action of WreathProductElems on AutGroupElem
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
function AutFG_emb(A::AutGroup, g::WreathProductElem)
|
||||
isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)")
|
||||
parent(g).P.n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A")
|
||||
powers = [(elt == parent(elt)() ? 0: 1) for elt in g.n.elts]
|
||||
elt = reduce(*, [A(Groups.flip_autsymbol(i))^pow for (i,pow) in enumerate(powers)])
|
||||
Groups.r_multiply!(elt, [Groups.perm_autsymbol(g.p)])
|
||||
return elt
|
||||
end
|
||||
|
||||
function AutFG_emb(A::AutGroup, p::perm)
|
||||
isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)")
|
||||
parent(p).n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A")
|
||||
return A(Groups.perm_autsymbol(p))
|
||||
end
|
||||
|
||||
function (g::WreathProductElem)(a::AutGroupElem)
|
||||
g = AutFG_emb(parent(a),g)
|
||||
return g*a*g^-1
|
||||
end
|
||||
|
||||
function (p::perm)(a::AutGroupElem)
|
||||
g = AutFG_emb(parent(a),p)
|
||||
return g*a*g^-1
|
||||
end
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Generating set
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
function SAutFN_generating_set(N::Int)
|
||||
|
||||
SAutFN = AutGroup(FreeGroup(N), special=true)
|
||||
S = gens(SAutFN);
|
||||
S = [S; [inv(s) for s in S]]
|
||||
|
||||
return SAutFN, unique(S)
|
||||
end
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -64,17 +6,6 @@ end
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
function cpuinfo_physicalcores()
|
||||
maxcore = -1
|
||||
for line in eachline("/proc/cpuinfo")
|
||||
if startswith(line, "core id")
|
||||
maxcore = max(maxcore, parse(Int, split(line, ':')[2]))
|
||||
end
|
||||
end
|
||||
maxcore < 0 && error("failure to read core ids from /proc/cpuinfo")
|
||||
return maxcore + 1
|
||||
end
|
||||
|
||||
function parse_commandline()
|
||||
settings = ArgParseSettings()
|
||||
|
||||
@ -108,56 +39,31 @@ function parse_commandline()
|
||||
return parse_args(settings)
|
||||
end
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# main
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
function main()
|
||||
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.")
|
||||
function cpuinfo_physicalcores()
|
||||
maxcore = -1
|
||||
for line in eachline("/proc/cpuinfo")
|
||||
if startswith(line, "core id")
|
||||
maxcore = max(maxcore, parse(Int, split(line, ':')[2]))
|
||||
end
|
||||
end
|
||||
maxcore < 0 && error("failure to read core ids from /proc/cpuinfo")
|
||||
return maxcore + 1
|
||||
end
|
||||
|
||||
if parsed_args["cpus"] == nothing
|
||||
N = cpuinfo_physicalcores()
|
||||
parsed_args["cpus"] = N
|
||||
info("Setting --cpus to $N")
|
||||
elseif parsed_args["cpus"] > cpuinfo_physicalcores()
|
||||
warn("Number of specified cores exceeds the physical core count. Performance may suffer.")
|
||||
end
|
||||
|
||||
addprocs(parsed_args["cpus"])
|
||||
BLAS.set_num_threads(parsed_args["cpus"])
|
||||
end
|
||||
|
||||
N = parsed_args["N"]
|
||||
radius = parsed_args["radius"]
|
||||
tol = parsed_args["tol"]
|
||||
iterations = parsed_args["iterations"]
|
||||
upper_bound = parsed_args["upper-bound"]
|
||||
include("SAutFNs.jl")
|
||||
|
||||
dirname = "oSAutF$(N)_r$radius"
|
||||
isdir(dirname) || mkdir(dirname)
|
||||
|
||||
logger = PropertyT.setup_logging(joinpath(dirname, "$(upper_bound)"))
|
||||
|
||||
info(logger, "Group: $dirname")
|
||||
info(logger, "Iterations: $iterations")
|
||||
info(logger, "Precision: $tol")
|
||||
info(logger, "Upper bound: $upper_bound")
|
||||
info(logger, "Threads: $(Threads.nthreads())")
|
||||
info(logger, "Workers: $(workers())")
|
||||
|
||||
G, S = SAutFN_generating_set(N)
|
||||
info(logger, G)
|
||||
info(logger, "Symmetric generating set of size $(length(S))")
|
||||
info(logger, S)
|
||||
AutS = WreathProduct(FiniteField(2,1, "a")[1], PermutationGroup(N))
|
||||
# AutS = PermutationGroup(N)
|
||||
|
||||
solver = SCSSolver(eps=tol, max_iters=iterations, linearsolver=SCS.Direct)
|
||||
# solver = Mosek.MosekSolver(
|
||||
# MSK_DPAR_INTPNT_CO_TOL_REL_GAP=tol,
|
||||
# MSK_IPAR_INTPNT_MAX_ITERATIONS=iterations,
|
||||
# QUIET=false)
|
||||
|
||||
sett = Settings(dirname, N, G, S, AutS, radius, solver, upper_bound, tol)
|
||||
|
||||
PropertyT.check_property_T(sett)
|
||||
end
|
||||
|
||||
main()
|
||||
include("Orbit.jl")
|
||||
main(SAutFNs, parsed_args)
|
||||
|
74
SAutFNs.jl
Normal file
74
SAutFNs.jl
Normal file
@ -0,0 +1,74 @@
|
||||
module SAutFNs
|
||||
|
||||
using Nemo
|
||||
using Groups
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Generating set
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
function generatingset(N::Int)
|
||||
|
||||
SAutFN = AutGroup(FreeGroup(N), special=true)
|
||||
S = gens(SAutFN);
|
||||
S = [S; [inv(s) for s in S]]
|
||||
|
||||
return SAutFN, unique(S)
|
||||
end
|
||||
|
||||
function generatingset(parsed_args)
|
||||
N = parsed_args["N"]
|
||||
return generatingset(N)
|
||||
end
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Action of WreathProductElems on AutGroupElem
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
function AutFG_emb(A::AutGroup, g::WreathProductElem)
|
||||
isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)")
|
||||
parent(g).P.n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A")
|
||||
powers = [(elt == parent(elt)() ? 0: 1) for elt in g.n.elts]
|
||||
elt = reduce(*, [A(Groups.flip_autsymbol(i))^pow for (i,pow) in enumerate(powers)])
|
||||
Groups.r_multiply!(elt, [Groups.perm_autsymbol(g.p)])
|
||||
return elt
|
||||
end
|
||||
|
||||
function AutFG_emb(A::AutGroup, p::perm)
|
||||
isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)")
|
||||
parent(p).n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A")
|
||||
return A(Groups.perm_autsymbol(p))
|
||||
end
|
||||
|
||||
function (g::WreathProductElem)(a::AutGroupElem)
|
||||
g = AutFG_emb(parent(a),g)
|
||||
return g*a*g^-1
|
||||
end
|
||||
|
||||
function (p::perm)(a::AutGroupElem)
|
||||
g = AutFG_emb(parent(a),p)
|
||||
return g*a*g^-1
|
||||
end
|
||||
|
||||
function autS(parsed_args)
|
||||
N = parsed_args["N"]
|
||||
return WreathProduct(PermutationGroup(2), PermutationGroup(N))
|
||||
# return WreathProduct(FiniteField(2,1, "a")[1], PermutationGroup(N))
|
||||
end
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Misc
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
function groupname(parsed_args)
|
||||
N = parsed_args["N"]
|
||||
return "oSAutF$(N)", N
|
||||
end
|
||||
|
||||
end # of module SAutFNs
|
Loading…
Reference in New Issue
Block a user