1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-11-30 09:10:27 +01:00

formatting

This commit is contained in:
Marek Kaluba 2022-02-13 11:38:31 +01:00
parent 7e540e8493
commit 91fb10742e
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 51 additions and 51 deletions

View File

@ -57,40 +57,41 @@ function SL2p_gens(p::Integer)
end end
end end
return a,b return a, b
end end
function adjacency(ϱ, a, b; prec=256) function adjacency(ϱ, a, b; prec = 256)
order_a = findfirst(i-> isone(a^i), 1:100) order_a = findfirst(i -> isone(a^i), 1:100)
order_b = findfirst(i-> isone(b^i), 1:100) order_b = findfirst(i -> isone(b^i), 1:100)
@assert !isnothing(order_a) && order_a > 1 @assert !isnothing(order_a) && order_a > 1
@assert !isnothing(order_b) && order_b > 1 @assert !isnothing(order_b) && order_b > 1
k = order_a-1 + order_b-1 k = order_a - 1 + order_b - 1
A = AcbMatrix(ϱ(a), prec=prec) A = AcbMatrix(ϱ(a), prec = prec)
B = AcbMatrix(ϱ(b), prec=prec) B = AcbMatrix(ϱ(b), prec = prec)
res = sum(A^i for i = 1:order_a-1) + sum(B^i for i = 1:order_b-1) res = sum(A^i for i = 1:order_a-1) + sum(B^i for i = 1:order_b-1)
return Arblib.scalar_div!(res, res, k) #return Arblib.scalar_div!(res, res, k)
return res
end end
function parse_our_args() function parse_our_args()
s = ArgParseSettings() s = ArgParseSettings()
@add_arg_table! s begin @add_arg_table! s begin
"-p" "-p"
help = "the prime p for which to use PSL(2,p)" help = "the prime p for which to use PSL(2,p)"
arg_type = Int arg_type = Int
required = true required = true
"-a" "-a"
help = "generator a (optional)" help = "generator a (optional)"
"-b" "-b"
help = "generator b (optional)" help = "generator b (optional)"
"--ab" "--ab"
help = "array of generators a and b (optional)" help = "array of generators a and b (optional)"
"--precision" "--precision"
help = "set the precision of computations" help = "set the precision of computations"
arg_type = Int arg_type = Int
default = 128 default = 128
end end
result = parse_args(s) result = parse_args(s)
@ -113,7 +114,8 @@ end
parsed_args = parse_our_args() parsed_args = parse_our_args()
const p = let p = parsed_args["p"] const p = let p = parsed_args["p"]
isprime(p) || @error "You need to provide a prime, ex: `julia adj_psl2_eigvals.jl -p 31`" isprime(p) ||
@error "You need to provide a prime, ex: `julia adj_psl2_eigvals.jl -p 31`"
p p
end end
@ -124,14 +126,14 @@ open(LOGFILE, "w") do io
@info "Logging into $LOGFILE" @info "Logging into $LOGFILE"
with_logger(SimpleLogger(io)) do with_logger(SimpleLogger(io)) do
@info "Arguments:" args=parsed_args @info "Arguments:" args = parsed_args
a,b = SL2p_gens(p) a, b = SL2p_gens(p)
a = SL₂{p}(get(parsed_args, "a", a)) a = SL₂{p}(get(parsed_args, "a", a))
b = SL₂{p}(get(parsed_args, "b", b)) b = SL₂{p}(get(parsed_args, "b", b))
@info "Generators" a b @info "Generators" a b
Borel_cosets = let p = p, (a,b) = (a,b) Borel_cosets = let p = p, (a, b) = (a, b)
SL2p, sizes = SL2p, sizes =
RamanujanGraphs.generate_balls([a, b, inv(a), inv(b)], radius = 21) RamanujanGraphs.generate_balls([a, b, inv(a), inv(b)], radius = 21)
@assert sizes[end] == RamanujanGraphs.order(SL₂{p}) @assert sizes[end] == RamanujanGraphs.order(SL₂{p})
@ -143,11 +145,11 @@ open(LOGFILE, "w") do io
for j = 0:(p-1)÷4 for j = 0:(p-1)÷4
h = PrincipalRepr( h = PrincipalRepr(
α => unit_root((p - 1) ÷ 2, j, prec=PRECISION), α => unit_root((p - 1) ÷ 2, j, prec = PRECISION),
Borel_cosets, Borel_cosets,
) )
@time adj = adjacency(h, a, b, prec=PRECISION) @time adj = adjacency(h, a, b, prec = PRECISION)
try try
@time evs = let evs = safe_eigvals(adj) @time evs = let evs = safe_eigvals(adj)
@ -168,20 +170,20 @@ open(LOGFILE, "w") do io
if p % 4 == 1 if p % 4 == 1
ub = (p - 1) ÷ 4 ub = (p - 1) ÷ 4
ζ = unit_root((p + 1) ÷ 2, 1, prec=PRECISION) ζ = unit_root((p + 1) ÷ 2, 1, prec = PRECISION)
else # p % 4 == 3 else # p % 4 == 3
ub = (p + 1) ÷ 4 ub = (p + 1) ÷ 4
ζ = unit_root((p + 1), 1, prec=PRECISION) ζ = unit_root((p + 1), 1, prec = PRECISION)
end end
for k = 1:ub for k = 1:ub
h = DiscreteRepr( h = DiscreteRepr(
RamanujanGraphs.GF{p}(1) => unit_root(p, prec=PRECISION), RamanujanGraphs.GF{p}(1) => unit_root(p, prec = PRECISION),
β => ζ^k, β => ζ^k,
) )
@time adj = adjacency(h, a, b, prec=PRECISION) @time adj = adjacency(h, a, b, prec = PRECISION)
try try
@time evs = let evs = safe_eigvals(adj) @time evs = let evs = safe_eigvals(adj)
@ -196,11 +198,11 @@ open(LOGFILE, "w") do io
end end
end end
end end
all_large_evs = sort(all_large_evs, rev=true) all_large_evs = sort(all_large_evs, rev = true)
λ = all_large_evs[2] λ = all_large_evs[2]
ε = (λ - 3)/5 ε = (λ - 3) / 5
α = acos(ε) α = acos(ε)
α_deg = (α/pi)*180 α_deg = (α / pi) * 180
@info "Certified values:" λ ε α α_deg @info "Certified values:" λ ε α α_deg
end # with_logger end # with_logger
end # open(logfile) end # open(logfile)

View File

@ -10,35 +10,33 @@ const DATA_DIR = joinpath(@__DIR__, "..", "..", "data")
function _files_with_extension(dir::AbstractString, ext::AbstractString) function _files_with_extension(dir::AbstractString, ext::AbstractString)
return [ return [
joinpath(dir, f) for f in readdir(dir) if joinpath(dir, f) for
isfile(joinpath(dir, f)) && endswith(f, '.'*ext) f in readdir(dir) if isfile(joinpath(dir, f)) && endswith(f, '.' * ext)
] ]
end end
all_grps_presentations = all_grps_presentations = let tables = _files_with_extension(DATA_DIR, "txt")
let tables = _files_with_extension(DATA_DIR, "txt") mapreduce(parse_grouppresentations_abstract, union, tables) |> Dict
mapreduce(parse_grouppresentations_abstract, union, tables) |> Dict end
end
grps = grps = let csvs = _files_with_extension(DATA_DIR, "csv")
let csvs = _files_with_extension(DATA_DIR, "csv")
trGrps = mapreduce(union, csvs) do file trGrps = mapreduce(union, csvs) do file
m = match(r".*_(\d)_(\d)_(\d).csv", basename(file)) m = match(r".*_(\d)_(\d)_(\d).csv", basename(file))
@assert !isnothing(m) @assert !isnothing(m)
type = parse.(Int, tuple(m[1], m[2], m[3])) type = parse.(Int, tuple(m[1], m[2], m[3]))
data = readdlm(file, '&') data = readdlm(file, '&')
labels = Symbol.(replace.(strip.(data[1, :]), ' ' => '_', '-' => '_')) labels = Symbol.(replace.(strip.(data[1, :]), ' ' => '_', '-' => '_'))
groups = data[2:end, :] groups = data[2:end, :]
grps = map(enumerate(eachrow(groups))) do (i, props) grps = map(enumerate(eachrow(groups))) do (i, props)
nt = (; (Symbol(l) => v for (l, v) in zip(labels, props))...) nt = (; (Symbol(l) => v for (l, v) in zip(labels, props))...)
@debug i, grp_name(nt) # @debug i, grp_name(nt)
P = all_grps_presentations[grp_name(nt)] P = all_grps_presentations[grp_name(nt)]
grp = TriangleGrp(type, P.generators, P.relations, nt) grp = TriangleGrp(type, P.generators, P.relations, nt)
end
end end
end end
end
open(joinpath(DATA_DIR, "triangle_groups.json"), "w") do io open(joinpath(DATA_DIR, "triangle_groups.json"), "w") do io
f(args...) = show_json(args...; indent = 4) f(args...) = show_json(args...; indent = 4)