mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-12-11 06:56:28 +01:00
use perms{Int8} in AutGroup and in tests
This commit is contained in:
parent
203e084ff3
commit
0233aedc41
@ -19,7 +19,7 @@ immutable FlipAut
|
|||||||
end
|
end
|
||||||
|
|
||||||
immutable PermAut
|
immutable PermAut
|
||||||
p::Nemo.Generic.perm
|
p::Nemo.Generic.perm{Int8}
|
||||||
end
|
end
|
||||||
|
|
||||||
immutable Identity end
|
immutable Identity end
|
||||||
@ -86,7 +86,7 @@ end
|
|||||||
|
|
||||||
# taken from ValidatedNumerics, under under the MIT "Expat" License:
|
# taken from ValidatedNumerics, under under the MIT "Expat" License:
|
||||||
# https://github.com/JuliaIntervals/ValidatedNumerics.jl/blob/master/LICENSE.md
|
# https://github.com/JuliaIntervals/ValidatedNumerics.jl/blob/master/LICENSE.md
|
||||||
function subscriptify(n::Int)
|
function subscriptify(n::Integer)
|
||||||
subscript_0 = Int(0x2080) # Char(0x2080) -> subscript 0
|
subscript_0 = Int(0x2080) # Char(0x2080) -> subscript 0
|
||||||
return join([Char(subscript_0 + i) for i in reverse(digits(n))])
|
return join([Char(subscript_0 + i) for i in reverse(digits(n))])
|
||||||
end
|
end
|
||||||
@ -115,7 +115,7 @@ function flip_autsymbol(i; pow::Int=1)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function perm_autsymbol(p::Generic.perm; pow::Int=1)
|
function perm_autsymbol(p::Generic.perm{Int8}; pow::Int=1)
|
||||||
p = p^pow
|
p = p^pow
|
||||||
if p == parent(p)()
|
if p == parent(p)()
|
||||||
return id_autsymbol()
|
return id_autsymbol()
|
||||||
@ -125,9 +125,9 @@ function perm_autsymbol(p::Generic.perm; pow::Int=1)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function perm_autsymbol(a::Vector{Int})
|
function perm_autsymbol(a::Vector{T}) where T<:Integer
|
||||||
G = PermutationGroup(length(a))
|
G = PermutationGroup(Int8(length(a)))
|
||||||
return perm_autsymbol(G(a))
|
return perm_autsymbol(G(Vector{Int8}(a)))
|
||||||
end
|
end
|
||||||
|
|
||||||
domain(G::AutGroup) = deepcopy(G.domain)
|
domain(G::AutGroup) = deepcopy(G.domain)
|
||||||
@ -152,7 +152,7 @@ function AutGroup(G::FreeGroup; special=false)
|
|||||||
|
|
||||||
if !special
|
if !special
|
||||||
flips = [flip_autsymbol(i) for i in 1:n]
|
flips = [flip_autsymbol(i) for i in 1:n]
|
||||||
syms = [perm_autsymbol(p) for p in elements(PermutationGroup(n))][2:end]
|
syms = [perm_autsymbol(p) for p in elements(PermutationGroup(Int8(n)))][2:end]
|
||||||
|
|
||||||
append!(S, [flips; syms])
|
append!(S, [flips; syms])
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
@testset "Automorphisms" begin
|
@testset "Automorphisms" begin
|
||||||
using Nemo
|
using Nemo
|
||||||
G = PermutationGroup(4)
|
G = PermutationGroup(Int8(4))
|
||||||
|
|
||||||
@testset "AutSymbol" begin
|
@testset "AutSymbol" begin
|
||||||
@test_throws MethodError Groups.AutSymbol("a")
|
@test_throws MethodError Groups.AutSymbol("a")
|
||||||
@ -8,7 +8,7 @@
|
|||||||
f = Groups.AutSymbol("a", 1, Groups.FlipAut(2))
|
f = Groups.AutSymbol("a", 1, Groups.FlipAut(2))
|
||||||
@test isa(f, Groups.GSymbol)
|
@test isa(f, Groups.GSymbol)
|
||||||
@test isa(f, Groups.AutSymbol)
|
@test isa(f, Groups.AutSymbol)
|
||||||
@test isa(Groups.perm_autsymbol(G([1,2,3,4])), Groups.AutSymbol)
|
@test isa(Groups.perm_autsymbol([1,2,3,4]), Groups.AutSymbol)
|
||||||
@test isa(Groups.rmul_autsymbol(1,2), Groups.AutSymbol)
|
@test isa(Groups.rmul_autsymbol(1,2), Groups.AutSymbol)
|
||||||
@test isa(Groups.lmul_autsymbol(3,4), Groups.AutSymbol)
|
@test isa(Groups.lmul_autsymbol(3,4), Groups.AutSymbol)
|
||||||
@test isa(Groups.flip_autsymbol(3), Groups.AutSymbol)
|
@test isa(Groups.flip_autsymbol(3), Groups.AutSymbol)
|
||||||
@ -29,21 +29,21 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
@testset "perm_autsymbol correctness" begin
|
@testset "perm_autsymbol correctness" begin
|
||||||
σ = Groups.perm_autsymbol(G([1,2,3,4]))
|
|
||||||
@test σ(domain) == domain
|
@test σ(domain) == domain
|
||||||
@test inv(σ)(domain) == domain
|
@test inv(σ)(domain) == domain
|
||||||
|
σ = Groups.perm_autsymbol([1,2,3,4])
|
||||||
|
|
||||||
σ = Groups.perm_autsymbol(G([2,3,4,1]))
|
|
||||||
@test σ(domain) == [b, c, d, a]
|
@test σ(domain) == [b, c, d, a]
|
||||||
@test inv(σ)(domain) == [d, a, b, c]
|
@test inv(σ)(domain) == [d, a, b, c]
|
||||||
|
σ = Groups.perm_autsymbol([2,3,4,1])
|
||||||
|
|
||||||
σ = Groups.perm_autsymbol(G([2,1,4,3]))
|
|
||||||
@test σ(domain) == [b, a, d, c]
|
@test σ(domain) == [b, a, d, c]
|
||||||
@test inv(σ)(domain) == [b, a, d, c]
|
@test inv(σ)(domain) == [b, a, d, c]
|
||||||
|
σ = Groups.perm_autsymbol([2,1,4,3])
|
||||||
|
|
||||||
σ = Groups.perm_autsymbol(G([2,3,1,4]))
|
|
||||||
@test σ(domain) == [b,c,a,d]
|
@test σ(domain) == [b,c,a,d]
|
||||||
@test inv(σ)(domain) == [c,a,b,d]
|
@test inv(σ)(domain) == [c,a,b,d]
|
||||||
|
σ = Groups.perm_autsymbol([2,3,1,4])
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "rmul/lmul_autsymbol correctness" begin
|
@testset "rmul/lmul_autsymbol correctness" begin
|
||||||
@ -115,21 +115,20 @@
|
|||||||
@test isa(A(Groups.flip_autsymbol(2)), AutGroupElem)
|
@test isa(A(Groups.flip_autsymbol(2)), AutGroupElem)
|
||||||
@test A(Groups.flip_autsymbol(2)) in gens
|
@test A(Groups.flip_autsymbol(2)) in gens
|
||||||
|
|
||||||
@test isa(A(Groups.perm_autsymbol(PermutationGroup(2)([2,1]))),
|
@test isa(A(Groups.perm_autsymbol([2,1])), AutGroupElem)
|
||||||
AutGroupElem)
|
@test A(Groups.perm_autsymbol([2,1])) in gens
|
||||||
@test A(Groups.perm_autsymbol(PermutationGroup(2)([2,1]))) in gens
|
|
||||||
end
|
end
|
||||||
|
|
||||||
A = AutGroup(FreeGroup(4))
|
A = AutGroup(FreeGroup(4))
|
||||||
|
|
||||||
@testset "eltary functions" begin
|
@testset "eltary functions" begin
|
||||||
|
|
||||||
f = Groups.perm_autsymbol(G([2,3,4,1]))
|
f = Groups.perm_autsymbol([2,3,4,1])
|
||||||
@test (Groups.change_pow(f, 2)).pow == 1
|
@test (Groups.change_pow(f, 2)).pow == 1
|
||||||
@test (Groups.change_pow(f, -2)).pow == 1
|
@test (Groups.change_pow(f, -2)).pow == 1
|
||||||
@test (inv(f)).pow == 1
|
@test (inv(f)).pow == 1
|
||||||
|
|
||||||
f = Groups.perm_autsymbol(G([2,1,4,3]))
|
f = Groups.perm_autsymbol([2,1,4,3])
|
||||||
@test isa(inv(f), Groups.AutSymbol)
|
@test isa(inv(f), Groups.AutSymbol)
|
||||||
|
|
||||||
@test_throws DomainError f^-1
|
@test_throws DomainError f^-1
|
||||||
@ -139,7 +138,7 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
@testset "reductions/arithmetic" begin
|
@testset "reductions/arithmetic" begin
|
||||||
f = Groups.perm_autsymbol(G([2,3,4,1]))
|
f = Groups.perm_autsymbol([2,3,4,1])
|
||||||
|
|
||||||
f² = Groups.r_multiply(A(f), [f], reduced=false)
|
f² = Groups.r_multiply(A(f), [f], reduced=false)
|
||||||
@test Groups.simplify_perms!(f²) == false
|
@test Groups.simplify_perms!(f²) == false
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
@testset "Constructors" begin
|
@testset "Constructors" begin
|
||||||
@test isa(Groups.DirectProductGroup(G,2), Nemo.Group)
|
@test isa(Groups.DirectProductGroup(G,2), Nemo.Group)
|
||||||
@test isa(G×G, Nemo.Group)
|
@test isa(G×G, Nemo.Group)
|
||||||
@test isa(Groups.DirectProductGroup(G,2), Groups.DirectProductGroup{Generic.PermGroup})
|
@test isa(Groups.DirectProductGroup(G,2), Groups.DirectProductGroup{Generic.PermGroup{Int64}})
|
||||||
|
|
||||||
GG = Groups.DirectProductGroup(G,2)
|
GG = Groups.DirectProductGroup(G,2)
|
||||||
|
|
||||||
@ -18,7 +18,7 @@
|
|||||||
@test GG(G(), G()) == GG()
|
@test GG(G(), G()) == GG()
|
||||||
|
|
||||||
@test isa(GG([g, g^2]), GroupElem)
|
@test isa(GG([g, g^2]), GroupElem)
|
||||||
@test isa(GG([g, g^2]), Groups.DirectProductGroupElem{Generic.perm})
|
@test isa(GG([g, g^2]), Groups.DirectProductGroupElem{Generic.perm{Int64}})
|
||||||
|
|
||||||
h = GG([g,g^2])
|
h = GG([g,g^2])
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
|
|
||||||
Wr = WreathProduct(PermutationGroup(2),S_3)
|
Wr = WreathProduct(PermutationGroup(2),S_3)
|
||||||
|
|
||||||
@test isa([elements(Wr)...], Vector{Groups.WreathProductElem{Generic.perm}})
|
@test isa([elements(Wr)...], Vector{Groups.WreathProductElem{Generic.perm{Int64}}})
|
||||||
|
|
||||||
elts = [elements(Wr)...]
|
elts = [elements(Wr)...]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user