From a14c6d2669d826b960c415be50beafdc7ac8970c Mon Sep 17 00:00:00 2001 From: Marek Kaluba Date: Mon, 20 Mar 2023 01:40:59 +0100 Subject: [PATCH] =?UTF-8?q?add=20G=E2=82=82=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/G₂_Adj.jl | 179 +++++++++++++++++++++++++ scripts/G₂_gens.jl | 308 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 487 insertions(+) create mode 100644 scripts/G₂_Adj.jl create mode 100644 scripts/G₂_gens.jl diff --git a/scripts/G₂_Adj.jl b/scripts/G₂_Adj.jl new file mode 100644 index 0000000..efc6770 --- /dev/null +++ b/scripts/G₂_Adj.jl @@ -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 +# ] diff --git a/scripts/G₂_gens.jl b/scripts/G₂_gens.jl new file mode 100644 index 0000000..48677d5 --- /dev/null +++ b/scripts/G₂_gens.jl @@ -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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, 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, 0, 0, 0, 0, 0, 0, 3, -1], + [0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0], + [0, 0, 0, 0, -1, 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], + [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