1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-26 10:35:29 +01:00

add G₂ script

This commit is contained in:
Marek Kaluba 2023-03-20 01:40:59 +01:00
parent 92d4ba0c20
commit a14c6d2669
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 487 additions and 0 deletions

179
scripts/G₂_Adj.jl Normal file
View File

@ -0,0 +1,179 @@
using LinearAlgebra
BLAS.set_num_threads(1)
ENV["OMP_NUM_THREADS"] = 4
using MKL_jll
include(joinpath(@__DIR__, "../test/optimizers.jl"))
using Groups
import Groups.MatrixGroups
using PropertyT
using SymbolicWedderburn
using SymbolicWedderburn.StarAlgebras
using PermutationGroups
include(joinpath(@__DIR__, "G₂_gens.jl"))
G, roots, Weyl = G₂_roots_weyl()
const HALFRADIUS = 2
const UPPER_BOUND = Inf
RG, S, sizes = @time PropertyT.group_algebra(G, halfradius = HALFRADIUS)
Δ = RG(length(S)) - sum(RG(s) for s in S)
wd = let Σ = Weyl, RG = RG
act = PropertyT.AlphabetPermutation{eltype(Σ),Int64}(
Dict(g => PermutationGroups.perm(g) for g in Σ),
)
@time SymbolicWedderburn.WedderburnDecomposition(
Float64,
Σ,
act,
basis(RG),
StarAlgebras.Basis{UInt16}(@view basis(RG)[1:sizes[HALFRADIUS]]),
semisimple = false,
)
end
elt = Δ^2
unit = Δ
@time model, varP = PropertyT.sos_problem_primal(
elt,
unit,
wd;
upper_bound = UPPER_BOUND,
augmented = true,
show_progress = true,
)
warm = nothing
begin
@time status, warm = PropertyT.solve(
model,
scs_optimizer(;
linear_solver = SCS.MKLDirectSolver,
eps = 1e-10,
max_iters = 20_000,
accel = 50,
alpha = 1.95,
),
warm,
)
@info "reconstructing the solution"
Q = @time begin
wd = wd
Ps = [JuMP.value.(P) for P in varP]
if any(any(isnan, P) for P in Ps)
throw("solver was probably interrupted, no valid solution available")
end
Qs = real.(sqrt.(Ps))
PropertyT.reconstruct(Qs, wd)
end
P = Q' * Q
@info "certifying the solution"
@time certified, λ = PropertyT.certify_solution(
elt,
unit,
JuMP.objective_value(model),
Q;
halfradius = HALFRADIUS,
augmented = true,
)
end
### grading below
function desubscriptify(symbol::Symbol)
digits = [
Int(l) - 0x2080 for
l in reverse(string(symbol)) if 0 Int(l) - 0x2080 9
]
res = 0
for (i, d) in enumerate(digits)
res += 10^(i - 1) * d
end
return res
end
function PropertyT.grading(g::MatrixGroups.MatrixElt, roots = roots)
id = desubscriptify(g.id)
return roots[id]
end
Δs = PropertyT.laplacians(
RG,
S,
x -> (gx = PropertyT.grading(x); Set([gx, -gx])),
)
elt = PropertyT.Adj(Δs)
elt == Δ^2 - PropertyT.Sq(Δs)
unit = Δ
@time model, varP = PropertyT.sos_problem_primal(
elt,
unit,
wd;
upper_bound = UPPER_BOUND,
augmented = true,
)
warm = nothing
begin
@time status, warm = PropertyT.solve(
model,
scs_optimizer(;
linear_solver = SCS.MKLDirectSolver,
eps = 1e-10,
max_iters = 50_000,
accel = 50,
alpha = 1.95,
),
warm,
)
@info "reconstructing the solution"
Q = @time begin
wd = wd
Ps = [JuMP.value.(P) for P in varP]
if any(any(isnan, P) for P in Ps)
throw("solver was probably interrupted, no valid solution available")
end
Qs = real.(sqrt.(Ps))
PropertyT.reconstruct(Qs, wd)
end
P = Q' * Q
@info "certifying the solution"
@time certified, λ = PropertyT.certify_solution(
elt,
unit,
JuMP.objective_value(model),
Q;
halfradius = HALFRADIUS,
augmented = true,
)
end
# Δ² - 1 / 1 · Sq → -0.8818044647162608
# Δ² - 2 / 3 · Sq → -0.1031738
# Δ² - 1 / 2 · Sq → 0.228296213895906
# Δ² - 1 / 3 · Sq → 0.520
# Δ² - 0 / 1 · Sq → 0.9676851592000731
# Sq → 0.333423
# vals = [
# 1.0 -0.8818
# 2/3 -0.1032
# 1/2 0.2282
# 1/3 0.520
# 0 0.9677
# ]

308
scripts/G₂_gens.jl Normal file
View File

@ -0,0 +1,308 @@
#= GAP code to generate matrices
alg := SimpleLieAlgebra("G", 2, Rationals);
root_sys := RootSystem(alg);
pos_gens := PositiveRootVectors(root_sys);
pos_rts := PositiveRoots(root_sys);
neg_gens := NegativeRootVectors(root_sys);
neg_rts := NegativeRoots(root_sys);
alg_gens := ShallowCopy(pos_gens);;
Append(alg_gens, neg_gens);
grading := ShallowCopy(pos_rts);
Append(grading, neg_rts);
mats := List(alg_gens, x->AdjointMatrix(Basis(alg), x));
W := WeylGroup(root_sys);
PW := Action(W, grading, OnRight);
=#
using LinearAlgebra
function matrix_exp(M::AbstractMatrix{<:Integer})
res = zeros(Rational{eltype(M)}, size(M))
res += I
k = 0
expM = one(M)
while !iszero(expM)
k += 1
expM *= M
@. res += 1 // factorial(k) * expM
if k == 20
@warn "matrix exponential did not converge" norm(expM - exp(M))
break
end
end
@debug "matrix_exp converged after $k iterations"
return res
end
const gap_adj_mats = [
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 1],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, -2, 0, 0, 0, 0, 0, 0, 0, 0],
],
]
function G₂_matrices_roots()
adj_mats = map(gap_adj_mats) do m
return hcat(m...)
end
adj_mats = filter!(!isdiag, adj_mats) # remove the ones from center
gens_mats = [convert(Matrix{Int}, matrix_exp(m')) for m in adj_mats]
#=
The roots from
G₂roots_gap = [
[2, -1], # α = e₁ - e₂
[-3, 2], # A = -α + β = -e₁ + 2e₂ - e₃
[-1, 1], # β = e₂ - e₃
[1, 0], # α + β = e₁ - e₃
[3, -1], # B = 2α + β = 2e₁ - e₂ - e₃
[0, 1], # A + B = α + 2β = e₁ + e₂ - 2e₃
[-2, 1], # -α
[3, -2], # -A
[1, -1], # -β
[-1, 0], # -α - β
[-3, 1], # -B
[0, -1], # -A - B
]
G₂roots_gap are the ones from cartan matrix. To obtain the standard
(hexagonal) picture map them by `T` defined as follows:
```julia
cartan = hcat(G₂roots_gap[1:2]...)
rot(α) = [cos(α) -sin(α); sin(α) cos(α)]
c₁ = [2, 0]
c₂ = rot(5π / 6) * [2, 0] * 3 # (= 1/2[√6, 1])
T = hcat(c₁, c₂) * inv(cartan)
```
By plotting one against the others (or by blind calculation) one can see
the following assignment. Here `⟨α, β⟩_ = A₂` and `⟨A, B⟩_ ≅ √3/√2 A₂`.
=#
e₁ = PropertyT.Roots.𝕖(3, 1)
e₂ = PropertyT.Roots.𝕖(3, 2)
e₃ = PropertyT.Roots.𝕖(3, 3)
α = e₁ - e₂
β = e₂ - e₃
A = -α + β
B = α + (α + β)
roots = [α, A, β, α + β, B, A + B, -α, -A, -β, -α - β, -B, -A - B]
return gens_mats, roots
end
function G₂_roots_weyl()
(mats, roots) = G₂_matrices_roots()
d = size(first(mats), 1)
G₂ = Groups.MatrixGroup{d}(mats)
m = Groups.gens(G₂)
σ = let w = m[1] * inv(m[7]) * m[1], m = union(m, inv.(m))
PermutationGroups.Perm([findfirst(==(inv(w) * x * w), m) for x in m])
end
τ = let w = m[2] * inv(m[8]) * m[2], m = union(m, inv.(m))
PermutationGroups.Perm([findfirst(==(inv(w) * x * w), m) for x in m])
end
W = PermGroup(σ, τ)
return G₂, roots, W
end