1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-07-27 21:10:31 +02:00
SmallHyperbolic/precomputed_reps_spectral_gap.jl

103 lines
2.5 KiB
Julia
Raw Normal View History

using Nemo
using DelimitedFiles
2020-05-15 01:25:30 +02:00
using LinearAlgebra
include("src/nemo_utils.jl")
2020-05-13 15:19:09 +02:00
const PRECISION = 256
2020-05-15 01:13:12 +02:00
function parse_eval(expr_str, value, var_name)
ex = Meta.parse(expr_str)
2020-05-15 01:25:30 +02:00
svar = :($var_name)
return @eval begin
2020-05-15 01:13:12 +02:00
let $svar = $value
2020-05-13 15:18:46 +02:00
$ex
end
end
end
2020-05-15 01:13:12 +02:00
function read_eval(fname, var_name, value)
2020-05-15 01:25:30 +02:00
a = readdlm(fname, ',', String)
a .= replace.(a, '/' => "//")
return parse_eval.(a, value, var_name)
2020-05-15 01:13:12 +02:00
end
2020-05-13 15:19:09 +02:00
function load_discrete_repr(i, q = 109; CC = AcbField(PRECISION))
2020-05-15 01:13:12 +02:00
ζ = root_of_unity(CC, (q + 1) ÷ 2)
2020-05-13 15:18:46 +02:00
degree = q - 1
2020-05-15 01:13:12 +02:00
ra = read_eval(
2020-05-13 15:18:46 +02:00
"data/Discrete reps PSL(2, $q)/discrete_rep_$(i)_a.txt",
2020-05-15 01:25:30 +02:00
:Z,
ζ,
)
2020-05-15 01:13:12 +02:00
a = matrix(CC, [CC(s) for s in ra[1:degree, 1:degree]])
2020-05-15 01:13:12 +02:00
rb = read_eval(
2020-05-13 15:18:46 +02:00
"data/Discrete reps PSL(2, $q)/discrete_rep_$(i)_b.txt",
2020-05-15 01:25:30 +02:00
:Z,
ζ,
)
2020-05-15 01:13:12 +02:00
b = matrix(CC, [CC(s) for s in rb[1:degree, 1:degree]])
2020-05-15 01:25:30 +02:00
@assert contains(det(a), 1)
@assert contains(det(b), 1)
2020-05-13 15:18:46 +02:00
return a, b
end
2020-05-13 15:19:09 +02:00
function load_principal_repr(i, q = 109; CC = AcbField(PRECISION))
2020-05-13 15:18:46 +02:00
ζ = root_of_unity(CC, (q - 1) ÷ 2)
degree = q + 1
2020-05-15 01:13:12 +02:00
ra = read_eval(
2020-05-13 15:18:46 +02:00
"data/Principal reps PSL(2, $q)/principal_rep_$(i)_a.txt",
2020-05-15 01:25:30 +02:00
:zz,
ζ,
)
2020-05-15 01:13:12 +02:00
a = matrix(CC, [CC(z) for z in ra[1:degree, 1:degree]])
2020-05-15 01:13:12 +02:00
rb = read_eval(
2020-05-13 15:18:46 +02:00
"data/Principal reps PSL(2, $q)/principal_rep_$(i)_b.txt",
2020-05-15 01:25:30 +02:00
:zz,
ζ,
)
b = matrix(CC, [CC(z) for z in rb[1:degree, 1:degree]])
@assert contains(det(a), 1)
@assert contains(det(b), 1)
2020-05-13 15:18:46 +02:00
return a, b
end
2020-05-15 01:25:30 +02:00
if !isinteractive()
2020-05-25 03:14:35 +02:00
2020-05-15 01:25:30 +02:00
for i = 0:27
try
a, b = load_principal_repr(i)
adjacency = sum(a^i for i = 1:4) + sum(b^i for i = 1:4)
@time ev = let evs = safe_eigvals(adjacency)
_count_multiplicites(evs)
end
@info "Principal Series Representation $i" ev[1:2] ev[end]
catch ex
@error "Principal Series Representation $i failed" ex
ex isa InterruptException && throw(ex)
end
end
2020-05-15 01:25:30 +02:00
for i = 1:27
try
a, b = load_discrete_repr(i)
adjacency = sum(a^i for i = 1:4) + sum(b^i for i = 1:4)
@time ev = let evs = safe_eigvals(adjacency)
_count_multiplicites(evs)
end
@info "Discrete Series Representation $i" ev[1:2] ev[end]
catch ex
@error "Discrete Series Representation $i : failed" ex
ex isa InterruptException && rethrow(ex)
end
end
end