diff --git a/test/1703.09680.jl b/test/1703.09680.jl index 6ed0f79..e801ab9 100644 --- a/test/1703.09680.jl +++ b/test/1703.09680.jl @@ -1,9 +1,8 @@ @testset "1703.09680 Examples" begin - @testset "SL(2,Z)" begin N = 2 G = MatrixGroups.SpecialLinearGroup{N}(Int8) - RG, S, sizes = PropertyT.group_algebra(G, halfradius=2, twisted=true) + RG, S, sizes = PropertyT.group_algebra(G; halfradius = 2) Δ = let RG = RG, S = S RG(length(S)) - sum(RG(s) for s in S) @@ -15,15 +14,15 @@ status, certified, λ = check_positivity( elt, - unit, - upper_bound=ub, - halfradius=2, - optimizer=scs_optimizer( - eps=1e-10, - max_iters=5_000, - accel=50, - alpha=1.9, - ) + unit; + upper_bound = ub, + halfradius = 2, + optimizer = scs_optimizer(; + eps = 1e-10, + max_iters = 5_000, + accel = 50, + alpha = 1.9, + ), ) @test status == JuMP.ALMOST_OPTIMAL @@ -33,8 +32,10 @@ @testset "SL(3,F₅)" begin N = 3 - G = MatrixGroups.SpecialLinearGroup{N}(SymbolicWedderburn.Characters.FiniteFields.GF{5}) - RG, S, sizes = PropertyT.group_algebra(G, halfradius=2, twisted=true) + G = MatrixGroups.SpecialLinearGroup{N}( + SymbolicWedderburn.Characters.FiniteFields.GF{5}, + ) + RG, S, sizes = PropertyT.group_algebra(G; halfradius = 2) Δ = let RG = RG, S = S RG(length(S)) - sum(RG(s) for s in S) @@ -46,15 +47,15 @@ status, certified, λ = check_positivity( elt, - unit, - upper_bound=ub, - halfradius=2, - optimizer=scs_optimizer( - eps=1e-10, - max_iters=5_000, - accel=50, - alpha=1.9, - ) + unit; + upper_bound = ub, + halfradius = 2, + optimizer = scs_optimizer(; + eps = 1e-10, + max_iters = 5_000, + accel = 50, + alpha = 1.9, + ), ) @test status == JuMP.OPTIMAL @@ -62,12 +63,15 @@ @test λ > 1 m = PropertyT.sos_problem_dual(elt, unit) - PropertyT.solve(m, cosmo_optimizer( - eps=1e-6, - max_iters=5_000, - accel=50, - alpha=1.9, - )) + PropertyT.solve( + m, + cosmo_optimizer(; + eps = 1e-6, + max_iters = 5_000, + accel = 50, + alpha = 1.9, + ), + ) @test JuMP.termination_status(m) in (JuMP.ALMOST_OPTIMAL, JuMP.OPTIMAL) @test JuMP.objective_value(m) ≈ 1.5 atol = 1e-2 @@ -76,7 +80,7 @@ @testset "SAut(F₂)" begin N = 2 G = SpecialAutomorphismGroup(FreeGroup(N)) - RG, S, sizes = PropertyT.group_algebra(G, halfradius=2, twisted=true) + RG, S, sizes = PropertyT.group_algebra(G; halfradius = 2) Δ = let RG = RG, S = S RG(length(S)) - sum(RG(s) for s in S) @@ -88,53 +92,46 @@ status, certified, λ = check_positivity( elt, - unit, - upper_bound=ub, - halfradius=2, - optimizer=scs_optimizer( - eps=1e-10, - max_iters=5_000, - accel=50, - alpha=1.9, - ) + unit; + upper_bound = ub, + halfradius = 2, + optimizer = scs_optimizer(; + eps = 1e-10, + max_iters = 5_000, + accel = 50, + alpha = 1.9, + ), ) @test status == JuMP.ALMOST_OPTIMAL @test λ < 0 @test !certified - @time sos_problem = - PropertyT.sos_problem_primal(elt, upper_bound=ub) + @time sos_problem = PropertyT.sos_problem_primal(elt; upper_bound = ub) status, _ = PropertyT.solve( sos_problem, - cosmo_optimizer( - eps=1e-7, - max_iters=10_000, - accel=0, - alpha=1.9, - ) + cosmo_optimizer(; + eps = 1e-7, + max_iters = 10_000, + accel = 0, + alpha = 1.9, + ), ) @test status == JuMP.OPTIMAL P = JuMP.value.(sos_problem[:P]) Q = real.(sqrt(P)) - certified, λ_cert = PropertyT.certify_solution( - elt, - zero(elt), - 0.0, - Q, - halfradius=2, - ) + certified, λ_cert = + PropertyT.certify_solution(elt, zero(elt), 0.0, Q; halfradius = 2) @test !certified @test λ_cert < 0 - end @testset "SL(3,Z) has (T)" begin n = 3 SL = MatrixGroups.SpecialLinearGroup{n}(Int8) - RSL, S, sizes = PropertyT.group_algebra(SL, halfradius=2, twisted=true) + RSL, S, sizes = PropertyT.group_algebra(SL; halfradius = 2) Δ = RSL(length(S)) - sum(RSL(s) for s in S) @@ -145,18 +142,18 @@ opt_problem = PropertyT.sos_problem_primal( elt, - unit, - upper_bound=ub, - augmented=false, + unit; + upper_bound = ub, + augmented = false, ) status, _ = PropertyT.solve( opt_problem, - cosmo_optimizer( - eps=1e-10, - max_iters=10_000, - accel=0, - alpha=1.5, + cosmo_optimizer(; + eps = 1e-10, + max_iters = 10_000, + accel = 0, + alpha = 1.5, ), ) @@ -170,13 +167,13 @@ elt, unit, λ, - Q, - halfradius=2, - augmented=false, + Q; + halfradius = 2, + augmented = false, ) @test certified - @test isapprox(λ_cert, λ, rtol=1e-5) + @test isapprox(λ_cert, λ, rtol = 1e-5) end @testset "augmented formulation" begin @@ -186,18 +183,18 @@ opt_problem = PropertyT.sos_problem_primal( elt, - unit, - upper_bound=ub, - augmented=true, + unit; + upper_bound = ub, + augmented = true, ) status, _ = PropertyT.solve( opt_problem, - scs_optimizer( - eps=1e-10, - max_iters=10_000, - accel=-10, - alpha=1.5, + scs_optimizer(; + eps = 1e-10, + max_iters = 10_000, + accel = -10, + alpha = 1.5, ), ) @@ -210,13 +207,13 @@ elt, unit, λ, - Q, - halfradius=2, - augmented=true, + Q; + halfradius = 2, + augmented = true, ) @test certified - @test isapprox(λ_cert, λ, rtol=1e-5) + @test isapprox(λ_cert, λ, rtol = 1e-5) @test λ_cert > 2 // 10 end end diff --git a/test/1712.07167.jl b/test/1712.07167.jl index be479d9..abc19b8 100644 --- a/test/1712.07167.jl +++ b/test/1712.07167.jl @@ -1,9 +1,9 @@ @testset "1712.07167 Examples" begin - @testset "SAut(F₃)" begin N = 3 G = SpecialAutomorphismGroup(FreeGroup(N)) - RG, S, sizes = PropertyT.group_algebra(G, halfradius=2, twisted=true) + @info "running tests for" G + RG, S, sizes = PropertyT.group_algebra(G; halfradius = 2) P = PermGroup(perm"(1,2)", Perm(circshift(1:N, -1))) Σ = PropertyT.Constructions.WreathProduct(PermGroup(perm"(1,2)"), P) @@ -15,6 +15,7 @@ basis(RG), StarAlgebras.Basis{UInt16}(@view basis(RG)[1:sizes[2]]), ) + @info wd Δ = let RG = RG, S = S RG(length(S)) - sum(RG(s) for s in S) @@ -27,14 +28,14 @@ status, certified, λ_cert = check_positivity( elt, unit, - wd, - upper_bound=ub, - halfradius=2, - optimizer=cosmo_optimizer( - eps=1e-7, - max_iters=10_000, - accel=50, - alpha=1.9, + wd; + upper_bound = ub, + halfradius = 2, + optimizer = cosmo_optimizer(; + eps = 1e-7, + max_iters = 10_000, + accel = 50, + alpha = 1.9, ), ) @@ -47,7 +48,8 @@ n = 3 SL = MatrixGroups.SpecialLinearGroup{n}(Int8) - RSL, S, sizes = PropertyT.group_algebra(SL, halfradius=2, twisted=true) + @info "running tests for" SL + RSL, S, sizes = PropertyT.group_algebra(SL; halfradius = 2) Δ = RSL(length(S)) - sum(RSL(s) for s in S) @@ -62,6 +64,7 @@ basis(RSL), StarAlgebras.Basis{UInt16}(@view basis(RSL)[1:sizes[2]]), ) + @info wd elt = Δ^2 unit = Δ @@ -71,8 +74,8 @@ elt, unit, wd, - upper_bound=ub, - augmented=false, + upper_bound = ub, + augmented = false, ) wdfl = SymbolicWedderburn.WedderburnDecomposition( @@ -86,18 +89,18 @@ model, varP = PropertyT.sos_problem_primal( elt, unit, - wdfl, - upper_bound=ub, - augmented=false, + wdfl; + upper_bound = ub, + augmented = false, ) status, warm = PropertyT.solve( model, - cosmo_optimizer( - eps=1e-10, - max_iters=20_000, - accel=50, - alpha=1.9, + cosmo_optimizer(; + eps = 1e-10, + max_iters = 20_000, + accel = 50, + alpha = 1.9, ), ) @@ -105,34 +108,34 @@ status, _ = PropertyT.solve( model, - scs_optimizer( - eps=1e-10, - max_iters=100, - accel=-20, - alpha=1.2, + scs_optimizer(; + eps = 1e-10, + max_iters = 100, + accel = -20, + alpha = 1.2, ), - warm + warm, ) @test status == JuMP.OPTIMAL Q = @time let varP = varP Qs = map(varP) do P - real.(sqrt(JuMP.value.(P))) + return real.(sqrt(JuMP.value.(P))) end PropertyT.reconstruct(Qs, wdfl) end λ = JuMP.value(model[:λ]) - sos = PropertyT.compute_sos(parent(elt), Q; augmented=false) + sos = PropertyT.compute_sos(parent(elt), Q; augmented = false) certified, λ_cert = PropertyT.certify_solution( elt, unit, λ, - Q, - halfradius=2, - augmented=false, + Q; + halfradius = 2, + augmented = false, ) @test certified @@ -155,22 +158,23 @@ basis(RSL), StarAlgebras.Basis{UInt16}(@view basis(RSL)[1:sizes[2]]), ) + @info wdfl opt_problem, varP = PropertyT.sos_problem_primal( elt, unit, - wdfl, - upper_bound=ub, + wdfl; + upper_bound = ub, # augmented = true # since both elt and unit are augmented ) status, _ = PropertyT.solve( opt_problem, - scs_optimizer( - eps=1e-8, - max_iters=20_000, - accel=0, - alpha=1.9, + scs_optimizer(; + eps = 1e-8, + max_iters = 20_000, + accel = 0, + alpha = 1.9, ), ) @@ -178,7 +182,7 @@ Q = @time let varP = varP Qs = map(varP) do P - real.(sqrt(JuMP.value.(P))) + return real.(sqrt(JuMP.value.(P))) end PropertyT.reconstruct(Qs, wdfl) end @@ -187,8 +191,8 @@ elt, unit, JuMP.objective_value(opt_problem), - Q, - halfradius=2, + Q; + halfradius = 2, # augmented = true # since both elt and unit are augmented ) diff --git a/test/1812.03456.jl b/test/1812.03456.jl index b0d9482..46802b9 100644 --- a/test/1812.03456.jl +++ b/test/1812.03456.jl @@ -21,8 +21,9 @@ using SparseArrays @testset "Sq, Adj, Op in SL(4,Z)" begin N = 4 G = MatrixGroups.SpecialLinearGroup{N}(Int8) + @info "running tests for" G - RG, S, sizes = PropertyT.group_algebra(G, halfradius=2, twisted=true) + RG, S, sizes = PropertyT.group_algebra(G; halfradius = 2) Δ = let RG = RG, S = S RG(length(S)) - sum(RG(s) for s in S) @@ -39,6 +40,7 @@ using SparseArrays basis(RG), StarAlgebras.Basis{UInt16}(@view basis(RG)[1:sizes[2]]), ) + @info wd ivs = SymbolicWedderburn.invariant_vectors(wd) sq, adj, op = PropertyT.SqAdjOp(RG, N) @@ -82,7 +84,7 @@ using SparseArrays @testset "SAut(F₃)" begin n = 3 G = SpecialAutomorphismGroup(FreeGroup(n)) - RG, S, sizes = PropertyT.group_algebra(G, halfradius=2, twisted=true) + RG, S, sizes = PropertyT.group_algebra(G; halfradius = 2) sq, adj, op = PropertyT.SqAdjOp(RG, n) @test sq(one(G)) == 216 @@ -98,7 +100,8 @@ end n = 3 G = MatrixGroups.SpecialLinearGroup{n}(Int8) - RG, S, sizes = PropertyT.group_algebra(G, halfradius=2, twisted=true) + @info "running tests for" G + RG, S, sizes = PropertyT.group_algebra(G; halfradius = 2) Δ = RG(length(S)) - sum(RG(s) for s in S) @@ -113,6 +116,7 @@ end basis(RG), StarAlgebras.Basis{UInt16}(@view basis(RG)[1:sizes[2]]), ) + @info wd sq, adj, op = PropertyT.SqAdjOp(RG, n) @@ -123,10 +127,10 @@ end status, certified, λ_cert = check_positivity( elt, Δ, - wd, - upper_bound=UB, - halfradius=2, - optimizer=cosmo_optimizer(accel=50, alpha=1.9) + wd; + upper_bound = UB, + halfradius = 2, + optimizer = cosmo_optimizer(; accel = 50, alpha = 1.9), ) @test status == JuMP.OPTIMAL @test certified @@ -140,10 +144,10 @@ end status, certified, λ_cert = check_positivity( elt, Δ, - wd, - upper_bound=UB, - halfradius=2, - optimizer=cosmo_optimizer(accel=50, alpha=1.9) + wd; + upper_bound = UB, + halfradius = 2, + optimizer = cosmo_optimizer(; accel = 50, alpha = 1.9), ) @test status == JuMP.OPTIMAL @test certified @@ -152,10 +156,11 @@ end m, _ = PropertyT.sos_problem_primal(elt, wd) PropertyT.solve( m, - scs_optimizer(max_iters=5000, accel=50, alpha=1.9) + scs_optimizer(; max_iters = 5000, accel = 50, alpha = 1.9), ) - @test JuMP.termination_status(m) in (JuMP.ALMOST_OPTIMAL, JuMP.OPTIMAL, JuMP.ITERATION_LIMIT) + @test JuMP.termination_status(m) in + (JuMP.ALMOST_OPTIMAL, JuMP.OPTIMAL, JuMP.ITERATION_LIMIT) @test abs(JuMP.objective_value(m)) < 1e-3 end @@ -168,10 +173,10 @@ end status, certified, λ_cert = check_positivity( elt, Δ, - wd, - upper_bound=UB, - halfradius=2, - optimizer=cosmo_optimizer(accel=50, alpha=1.9) + wd; + upper_bound = UB, + halfradius = 2, + optimizer = cosmo_optimizer(; accel = 50, alpha = 1.9), ) @test status == JuMP.OPTIMAL @test !certified @@ -183,7 +188,8 @@ end n = 4 G = MatrixGroups.SpecialLinearGroup{n}(Int8) - RG, S, sizes = PropertyT.group_algebra(G, halfradius=2, twisted=true) + @info "running tests for" G + RG, S, sizes = PropertyT.group_algebra(G; halfradius = 2) Δ = RG(length(S)) - sum(RG(s) for s in S) @@ -198,6 +204,7 @@ end basis(RG), StarAlgebras.Basis{UInt16}(@view basis(RG)[1:sizes[2]]), ) + @info wd sq, adj, op = PropertyT.SqAdjOp(RG, n) @@ -208,10 +215,10 @@ end status, certified, λ_cert = check_positivity( elt, Δ, - wd, - upper_bound=UB, - halfradius=2, - optimizer=cosmo_optimizer(accel=50, alpha=1.9) + wd; + upper_bound = UB, + halfradius = 2, + optimizer = cosmo_optimizer(; accel = 50, alpha = 1.9), ) @test status == JuMP.OPTIMAL @test certified @@ -225,10 +232,10 @@ end status, certified, λ_cert = check_positivity( elt, Δ, - wd, - upper_bound=UB, - halfradius=2, - optimizer=cosmo_optimizer(accel=50, alpha=1.9) + wd; + upper_bound = UB, + halfradius = 2, + optimizer = cosmo_optimizer(; accel = 50, alpha = 1.9), ) @test status == JuMP.OPTIMAL @test certified @@ -242,10 +249,10 @@ end status, certified, λ_cert = check_positivity( elt, Δ, - wd, - upper_bound=UB, - halfradius=2, - optimizer=cosmo_optimizer(accel=50, alpha=1.9) + wd; + upper_bound = UB, + halfradius = 2, + optimizer = cosmo_optimizer(; accel = 50, alpha = 1.9), ) @test status == JuMP.OPTIMAL @test !certified diff --git a/test/Chevalley.jl b/test/Chevalley.jl new file mode 100644 index 0000000..4bb5862 --- /dev/null +++ b/test/Chevalley.jl @@ -0,0 +1,168 @@ +countmap(v) = countmap(identity, v) +function countmap(f, v) + counts = Dict{eltype(f(first(v))),Int}() + for x in v + fx = f(x) + counts[fx] = get!(counts, fx, 0) + 1 + end + return counts +end + +@testset "classify_root_system" begin + α = PropertyT.Roots.Root([1, -1, 0]) + β = PropertyT.Roots.Root([0, 1, -1]) + γ = PropertyT.Roots.Root([2, 0, 0]) + + @test PropertyT.Roots.classify_root_system(α, β, (false, false)) == :A₂ + @test PropertyT.Roots.classify_root_system(α, γ, (false, true)) == :C₂ + @test PropertyT.Roots.classify_root_system(β, γ, (false, true)) == + Symbol("A₁×C₁") +end + +@testset "Exceptional root systems" begin + @testset "F4" begin + F4 = let Σ = PermutationGroups.PermGroup(perm"(1,2,3,4)", perm"(1,2)") + long = let x = (1.0, 1.0, 0.0, 0.0) + PropertyT.Roots.Root.( + union( + (x^g for g in Σ), + ((x .* (-1, 1, 1, 1))^g for g in Σ), + ((-1 .* x)^g for g in Σ), + ), + ) + end + + short = let x = (1.0, 0.0, 0.0, 0.0) + PropertyT.Roots.Root.( + union((x^g for g in Σ), ((-1 .* x)^g for g in Σ)) + ) + end + + signs = collect(Iterators.product(fill([-1, +1], 4)...)) + halfs = let x = 1 / 2 .* (1.0, 1.0, 1.0, 1.0) + PropertyT.Roots.Root.(union(x .* sgn for sgn in signs)) + end + + union(long, short, halfs) + end + + @test length(F4) == 48 + + a = F4[1] + @test isapprox(length(a), sqrt(2)) + b = F4[6] + @test isapprox(length(b), sqrt(2)) + c = a + b + @test isapprox(length(c), 2.0) + @test PropertyT.Roots.classify_root_system(b, c, (false, true)) == :C₂ + + long = F4[findfirst(r -> length(r) == sqrt(2), F4)] + short = F4[findfirst(r -> length(r) == 1.0, F4)] + + subtypes = Set([:C₂, :A₂, Symbol("A₁×C₁")]) + + let Ω = F4, α = long + counts = countmap([ + PropertyT.Roots.classify_sub_root_system(Ω, α, γ) for + γ in Ω if !PropertyT.Roots.isproportional(α, γ) + ]) + @test Set(keys(counts)) == subtypes + d, r = divrem(counts[:C₂], 6) + @test r == 0 && d == 3 + + d, r = divrem(counts[:A₂], 4) + @test r == 0 && d == 4 + end + + let Ω = F4, α = short + counts = countmap([ + PropertyT.Roots.classify_sub_root_system(Ω, α, γ) for + γ in Ω if !PropertyT.Roots.isproportional(α, γ) + ]) + @test Set(keys(counts)) == subtypes + d, r = divrem(counts[:C₂], 6) + @test r == 0 && d == 3 + + d, r = divrem(counts[:A₂], 4) + @test r == 0 && d == 4 + end + end + + @testset "E6-7-8 exceptional root systems" begin + E8 = + let Σ = PermutationGroups.PermGroup( + perm"(1,2,3,4,5,6,7,8)", + perm"(1,2)", + ) + long = let x = (1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) + PropertyT.Roots.Root.( + union( + (x^g for g in Σ), + ((x .* (-1, 1, 1, 1, 1, 1, 1, 1))^g for g in Σ), + ((-1 .* x)^g for g in Σ), + ), + ) + end + + signs = collect( + p for p in Iterators.product(fill([-1, +1], 8)...) if + iseven(count(==(-1), p)) + ) + halfs = let x = 1 / 2 .* ntuple(i -> 1.0, 8) + rts = unique(PropertyT.Roots.Root(x .* sgn) for sgn in signs) + end + + union(long, halfs) + end + + subtypes = Set([:A₂, Symbol("A₁×A₁")]) + + @testset "E8" begin + @test length(E8) == 240 + @test all(r -> length(r) ≈ sqrt(2), E8) + + let Ω = E8, α = first(Ω) + counts = countmap([ + PropertyT.Roots.classify_sub_root_system(Ω, α, γ) for + γ in Ω if !PropertyT.Roots.isproportional(α, γ) + ]) + @test Set(keys(counts)) == subtypes + d, r = divrem(counts[:A₂], 4) + @test r == 0 && d == 28 + end + end + @testset "E7" begin + E7 = filter(r -> iszero(sum(r.coord)), E8) + @test length(E7) == 126 + + let Ω = E7, α = first(Ω) + counts = countmap([ + PropertyT.Roots.classify_sub_root_system(Ω, α, γ) for + γ in Ω if !PropertyT.Roots.isproportional(α, γ) + ]) + @test Set(keys(counts)) == subtypes + d, r = divrem(counts[:A₂], 4) + @test r == 0 && d == 16 + end + end + + @testset "E6" begin + E6 = filter( + r -> r.coord[end] == r.coord[end-1] == r.coord[end-2], + E8, + ) + @test length(E6) == 72 + + let Ω = E6, α = first(Ω) + counts = countmap([ + PropertyT.Roots.classify_sub_root_system(Ω, α, γ) for + γ in Ω if !PropertyT.Roots.isproportional(α, γ) + ]) + @test Set(keys(counts)) == subtypes + d, r = divrem(counts[:A₂], 4) + @info d, r + @test r == 0 && d == 10 + end + end + end +end diff --git a/test/actions.jl b/test/actions.jl index af7d123..08e6a03 100644 --- a/test/actions.jl +++ b/test/actions.jl @@ -3,7 +3,7 @@ function test_action(basis, group, act) return @testset "action definition" begin @test all(basis) do b e = one(group) - action(act, e, b) == b + return action(act, e, b) == b end a = let a = rand(basis) @@ -30,12 +30,12 @@ function test_action(basis, group, act) @test all([(g, h) for g in group for h in group]) do (g, h) x = action(act, h, action(act, g, a)) y = action(act, g * h, a) - x == y + return x == y end if act isa SymbolicWedderburn.ByPermutations @test all(basis) do b - action(act, g, b) ∈ basis && action(act, h, b) ∈ basis + return action(act, g, b) ∈ basis && action(act, h, b) ∈ basis end end end @@ -44,21 +44,18 @@ end ## Testing @testset "Actions on SL(3,ℤ)" begin - n = 3 SL = MatrixGroups.SpecialLinearGroup{n}(Int8) - RSL, S, sizes = PropertyT.group_algebra(SL, halfradius=2, twisted=true) + RSL, S, sizes = PropertyT.group_algebra(SL; halfradius = 2) @testset "Permutation action" begin - Γ = PermGroup(perm"(1,2)", Perm(circshift(1:n, -1))) ΓpA = PropertyT.action_by_conjugation(SL, Γ) test_action(basis(RSL), Γ, ΓpA) @testset "mps is successful" begin - charsΓ = SymbolicWedderburn.Character{ Rational{Int}, @@ -66,9 +63,9 @@ end RΓ = SymbolicWedderburn._group_algebra(Γ) - @time mps, simple = + @time mps, ranks = SymbolicWedderburn.minimal_projection_system(charsΓ, RΓ) - @test all(simple) + @test all(isone, ranks) end @testset "Wedderburn decomposition" begin @@ -77,17 +74,17 @@ end Γ, ΓpA, basis(RSL), - StarAlgebras.Basis{UInt16}(@view basis(RSL)[1:sizes[2]]) + StarAlgebras.Basis{UInt16}(@view basis(RSL)[1:sizes[2]]), ) @test length(invariant_vectors(wd)) == 918 - @test SymbolicWedderburn.size.(direct_summands(wd), 1) == [40, 23, 18] + @test SymbolicWedderburn.size.(direct_summands(wd), 1) == + [40, 23, 18] @test all(issimple, direct_summands(wd)) end end @testset "Wreath action" begin - Γ = let P = PermGroup(perm"(1,2)", Perm(circshift(1:n, -1))) PropertyT.Constructions.WreathProduct(PermGroup(perm"(1,2)"), P) end @@ -97,7 +94,6 @@ end test_action(basis(RSL), Γ, ΓpA) @testset "mps is successful" begin - charsΓ = SymbolicWedderburn.Character{ Rational{Int}, @@ -105,9 +101,9 @@ end RΓ = SymbolicWedderburn._group_algebra(Γ) - @time mps, simple = + @time mps, ranks = SymbolicWedderburn.minimal_projection_system(charsΓ, RΓ) - @test all(simple) + @test all(isone, ranks) end @testset "Wedderburn decomposition" begin @@ -116,32 +112,30 @@ end Γ, ΓpA, basis(RSL), - StarAlgebras.Basis{UInt16}(@view basis(RSL)[1:sizes[2]]) + StarAlgebras.Basis{UInt16}(@view basis(RSL)[1:sizes[2]]), ) @test length(invariant_vectors(wd)) == 247 - @test SymbolicWedderburn.size.(direct_summands(wd), 1) == [14, 9, 6, 14, 12] + @test SymbolicWedderburn.size.(direct_summands(wd), 1) == + [14, 9, 6, 14, 12] @test all(issimple, direct_summands(wd)) end end end @testset "Actions on SAut(F4)" begin - n = 4 SAutFn = SpecialAutomorphismGroup(FreeGroup(n)) - RSAutFn, S, sizes = PropertyT.group_algebra(SAutFn, halfradius=1, twisted=true) + RSAutFn, S, sizes = PropertyT.group_algebra(SAutFn; halfradius = 1) @testset "Permutation action" begin - Γ = PermGroup(perm"(1,2)", Perm(circshift(1:n, -1))) ΓpA = PropertyT.action_by_conjugation(SAutFn, Γ) test_action(basis(RSAutFn), Γ, ΓpA) @testset "mps is successful" begin - charsΓ = SymbolicWedderburn.Character{ Rational{Int}, @@ -149,9 +143,9 @@ end RΓ = SymbolicWedderburn._group_algebra(Γ) - @time mps, simple = + @time mps, ranks = SymbolicWedderburn.minimal_projection_system(charsΓ, RΓ) - @test all(simple) + @test all(isone, ranks) end @testset "Wedderburn decomposition" begin @@ -160,17 +154,17 @@ end Γ, ΓpA, basis(RSAutFn), - StarAlgebras.Basis{UInt16}(@view basis(RSAutFn)[1:sizes[1]]) + StarAlgebras.Basis{UInt16}(@view basis(RSAutFn)[1:sizes[1]]), ) @test length(invariant_vectors(wd)) == 93 - @test SymbolicWedderburn.size.(direct_summands(wd), 1) == [4, 8, 5, 4] + @test SymbolicWedderburn.size.(direct_summands(wd), 1) == + [4, 8, 5, 4] @test all(issimple, direct_summands(wd)) end end @testset "Wreath action" begin - Γ = let P = PermGroup(perm"(1,2)", Perm(circshift(1:n, -1))) PropertyT.Constructions.WreathProduct(PermGroup(perm"(1,2)"), P) end @@ -180,7 +174,6 @@ end test_action(basis(RSAutFn), Γ, ΓpA) @testset "mps is successful" begin - charsΓ = SymbolicWedderburn.Character{ Rational{Int}, @@ -188,9 +181,9 @@ end RΓ = SymbolicWedderburn._group_algebra(Γ) - @time mps, simple = + @time mps, ranks = SymbolicWedderburn.minimal_projection_system(charsΓ, RΓ) - @test all(simple) + @test all(isone, ranks) end @testset "Wedderburn decomposition" begin @@ -199,11 +192,12 @@ end Γ, ΓpA, basis(RSAutFn), - StarAlgebras.Basis{UInt16}(@view basis(RSAutFn)[1:sizes[1]]) + StarAlgebras.Basis{UInt16}(@view basis(RSAutFn)[1:sizes[1]]), ) @test length(invariant_vectors(wd)) == 18 - @test SymbolicWedderburn.size.(direct_summands(wd), 1) == [1, 1, 2, 2, 1, 2, 2, 1] + @test SymbolicWedderburn.size.(direct_summands(wd), 1) == + [1, 1, 2, 2, 1, 2, 2, 1] @test all(issimple, direct_summands(wd)) end end diff --git a/test/check_positivity.jl b/test/check_positivity.jl index 974077b..d57e80f 100644 --- a/test/check_positivity.jl +++ b/test/check_positivity.jl @@ -1,6 +1,12 @@ -function check_positivity(elt, unit; upper_bound=Inf, halfradius=2, optimizer) +function check_positivity( + elt, + unit; + upper_bound = Inf, + halfradius = 2, + optimizer, +) @time sos_problem = - PropertyT.sos_problem_primal(elt, unit, upper_bound=upper_bound) + PropertyT.sos_problem_primal(elt, unit; upper_bound = upper_bound) status, _ = PropertyT.solve(sos_problem, optimizer) P = JuMP.value.(sos_problem[:P]) @@ -9,16 +15,23 @@ function check_positivity(elt, unit; upper_bound=Inf, halfradius=2, optimizer) elt, unit, JuMP.objective_value(sos_problem), - Q, - halfradius=halfradius, + Q; + halfradius = halfradius, ) return status, certified, λ_cert end -function check_positivity(elt, unit, wd; upper_bound=Inf, halfradius=2, optimizer) +function check_positivity( + elt, + unit, + wd; + upper_bound = Inf, + halfradius = 2, + optimizer, +) @assert aug(elt) == aug(unit) == 0 @time sos_problem, Ps = - PropertyT.sos_problem_primal(elt, unit, wd, upper_bound=upper_bound) + PropertyT.sos_problem_primal(elt, unit, wd; upper_bound = upper_bound) @time status, _ = PropertyT.solve(sos_problem, optimizer) @@ -29,13 +42,7 @@ function check_positivity(elt, unit, wd; upper_bound=Inf, halfradius=2, optimize λ = JuMP.value(sos_problem[:λ]) - certified, λ_cert = PropertyT.certify_solution( - elt, - unit, - λ, - Q, - halfradius=halfradius - ) + certified, λ_cert = + PropertyT.certify_solution(elt, unit, λ, Q; halfradius = halfradius) return status, certified, λ_cert end - diff --git a/test/graded_adj.jl b/test/graded_adj.jl index bf5a804..447b58c 100644 --- a/test/graded_adj.jl +++ b/test/graded_adj.jl @@ -1,10 +1,9 @@ @testset "Adj via grading" begin - @testset "SL(n,Z) & Aut(F₄)" begin n = 4 halfradius = 1 SL = MatrixGroups.SpecialLinearGroup{n}(Int8) - RSL, S, sizes = PropertyT.group_algebra(SL, halfradius=halfradius, twisted=true) + RSL, S, sizes = PropertyT.group_algebra(SL; halfradius = halfradius) Δ = RSL(length(S)) - sum(RSL(s) for s in S) @@ -22,10 +21,9 @@ @test PropertyT.Adj(Δs, :A₂) == adj @test PropertyT.Adj(Δs, Symbol("A₁×A₁")) == op - halfradius = 1 G = SpecialAutomorphismGroup(FreeGroup(n)) - RG, S, sizes = PropertyT.group_algebra(G, halfradius=halfradius, twisted=true) + RG, S, sizes = PropertyT.group_algebra(G; halfradius = halfradius) Δ = RG(length(S)) - sum(RG(s) for s in S) @@ -44,7 +42,6 @@ @test PropertyT.Adj(Δs, Symbol("A₁×A₁")) == op end - @testset "Symplectic group" begin @testset "Sp2(ℤ)" begin genus = 2 @@ -52,7 +49,8 @@ SpN = MatrixGroups.SymplecticGroup{2genus}(Int8) - RSpN, S_sp, sizes_sp = PropertyT.group_algebra(SpN, halfradius=halfradius, twisted=true) + RSpN, S_sp, sizes_sp = + PropertyT.group_algebra(SpN; halfradius = halfradius) Δ, Δs = let RG = RSpN, S = S_sp, ψ = identity Δ = RG(length(S)) - sum(RG(s) for s in S) @@ -73,7 +71,8 @@ SpN = MatrixGroups.SymplecticGroup{2genus}(Int8) - RSpN, S_sp, sizes_sp = PropertyT.group_algebra(SpN, halfradius=halfradius, twisted=true) + RSpN, S_sp, sizes_sp = + PropertyT.group_algebra(SpN; halfradius = halfradius) Δ, Δs = let RG = RSpN, S = S_sp, ψ = identity Δ = RG(length(S)) - sum(RG(s) for s in S) @@ -86,9 +85,14 @@ end @testset "Adj numerics for genus=$genus" begin - all_subtypes = ( - :A₁, :C₁, Symbol("A₁×A₁"), Symbol("C₁×C₁"), Symbol("A₁×C₁"), :A₂, :C₂ + :A₁, + :C₁, + Symbol("A₁×A₁"), + Symbol("C₁×C₁"), + Symbol("A₁×C₁"), + :A₂, + :C₂, ) @test PropertyT.Adj(Δs, :A₂)[one(SpN)] == 384 @@ -101,8 +105,8 @@ @test isinteger(PropertyT.Adj(Δs, subtype)[one(SpN)] / 16) end end - @test sum(PropertyT.Adj(Δs, subtype) for subtype in all_subtypes) == Δ^2 + @test sum(PropertyT.Adj(Δs, subtype) for subtype in all_subtypes) == + Δ^2 end end end - diff --git a/test/quick_tests.jl b/test/quick_tests.jl index 9a38b5c..9478286 100644 --- a/test/quick_tests.jl +++ b/test/quick_tests.jl @@ -1,11 +1,12 @@ @testset "Quick tests" begin - @testset "SL(2,F₇)" begin N = 2 p = 7 halfradius = 3 - G = MatrixGroups.SpecialLinearGroup{N}(SymbolicWedderburn.Characters.FiniteFields.GF{p}) - RG, S, sizes = PropertyT.group_algebra(G, halfradius=3, twisted=true) + G = MatrixGroups.SpecialLinearGroup{N}( + SymbolicWedderburn.Characters.FiniteFields.GF{p}, + ) + RG, S, sizes = PropertyT.group_algebra(G; halfradius = 3) Δ = let RG = RG, S = S RG(length(S)) - sum(RG(s) for s in S) @@ -18,15 +19,15 @@ @testset "standard formulation" begin status, certified, λ_cert = check_positivity( elt, - unit, - upper_bound=ub, - halfradius=2, - optimizer=cosmo_optimizer( - eps=1e-7, - max_iters=5_000, - accel=50, - alpha=1.95, - ) + unit; + upper_bound = ub, + halfradius = 2, + optimizer = cosmo_optimizer(; + eps = 1e-7, + max_iters = 5_000, + accel = 50, + alpha = 1.95, + ), ) @test status == JuMP.OPTIMAL @@ -34,14 +35,18 @@ @test λ_cert > 5857 // 10000 m = PropertyT.sos_problem_dual(elt, unit) - PropertyT.solve(m, cosmo_optimizer( - eps=1e-7, - max_iters=10_000, - accel=50, - alpha=1.95, - )) + PropertyT.solve( + m, + cosmo_optimizer(; + eps = 1e-7, + max_iters = 10_000, + accel = 50, + alpha = 1.95, + ), + ) - @test JuMP.termination_status(m) in (JuMP.ALMOST_OPTIMAL, JuMP.OPTIMAL) + @test JuMP.termination_status(m) in + (JuMP.ALMOST_OPTIMAL, JuMP.OPTIMAL) @test JuMP.objective_value(m) ≈ λ_cert atol = 1e-2 end @@ -55,20 +60,22 @@ Σ, act, basis(RG), - StarAlgebras.Basis{UInt16}(@view basis(RG)[1:sizes[halfradius]]), + StarAlgebras.Basis{UInt16}( + @view basis(RG)[1:sizes[halfradius]] + ), ) status, certified, λ_cert = check_positivity( elt, unit, - wd, - upper_bound=ub, - halfradius=2, - optimizer=cosmo_optimizer( - eps=1e-7, - max_iters=10_000, - accel=50, - alpha=1.9, + wd; + upper_bound = ub, + halfradius = 2, + optimizer = cosmo_optimizer(; + eps = 1e-7, + max_iters = 10_000, + accel = 50, + alpha = 1.9, ), ) diff --git a/test/runtests.jl b/test/runtests.jl index 7003c1e..5e6a9be 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -25,5 +25,6 @@ if haskey(ENV, "FULL_TEST") || haskey(ENV, "CI") include("1812.03456.jl") include("graded_adj.jl") + include("Chevalley.jl") end end