1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-25 18:15:29 +01:00

rename *_autsymbol to more descriptive names

This commit is contained in:
kalmarek 2020-03-25 00:46:23 +01:00
parent 02ce259eb4
commit b9c2a90bae
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -25,14 +25,14 @@ end
struct Identity end struct Identity end
struct AutSymbol <: GSymbol struct AutSymbol <: GSymbol
id::Symbol id::Symbol
pow::Int8 pow::Int8
fn::Union{LTransvect, RTransvect, PermAut, FlipAut, Identity} fn::Union{LTransvect, RTransvect, PermAut, FlipAut, Identity}
end end
mutable struct AutGroup{N} <: AbstractFPGroup mutable struct AutGroup{N} <: AbstractFPGroup
objectGroup::FreeGroup objectGroup::FreeGroup
gens::Vector{AutSymbol} gens::Vector{AutSymbol}
end end
mutable struct Automorphism{N} <: GWord{AutSymbol} mutable struct Automorphism{N} <: GWord{AutSymbol}
@ -113,42 +113,43 @@ function id_autsymbol()
return AutSymbol(Symbol("(id)"), 0, Identity()) return AutSymbol(Symbol("(id)"), 0, Identity())
end end
function rmul_autsymbol(i::Integer, j::Integer; pow::Integer=1) function transvection_R(i::Integer, j::Integer, pow::Integer=1)
id = Symbol("ϱ", subscriptify(i), subscriptify(j)) id = Symbol("ϱ", subscriptify(i), subscriptify(j))
return AutSymbol(id, pow, RTransvect(i, j)) return AutSymbol(id, pow, RTransvect(i, j))
end end
function lmul_autsymbol(i::Integer, j::Integer; pow::Integer=1) function transvection_L(i::Integer, j::Integer, pow::Integer=1)
id = Symbol("λ", subscriptify(i), subscriptify(j)) id = Symbol("λ", subscriptify(i), subscriptify(j))
return AutSymbol(id, pow, LTransvect(i, j)) return AutSymbol(id, pow, LTransvect(i, j))
end end
function flip_autsymbol(i::Integer; pow::Integer=1) function flip(i::Integer, pow::Integer=1)
if iseven(pow) iseven(pow) && return id_autsymbol()
return id_autsymbol() id = Symbol("ɛ", subscriptify(i))
else return AutSymbol(id, 1, FlipAut(i))
id = Symbol("ɛ", subscriptify(i))
return AutSymbol(id, 1, FlipAut(i))
end
end end
function perm_autsymbol(p::Generic.Perm{I}; pow::Integer=one(I)) where I<:Integer function AutSymbol(p::Generic.Perm, pow::Integer=1)
if pow != 1 if pow != 1
p = p^pow p = p^pow
end end
for i in eachindex(p.d)
if p.d[i] != i if any(p.d[i] != i for i in eachindex(p.d))
id = Symbol("σ", [subscriptify(i) for i in p.d]...) id = Symbol("σ", "", [subscriptify(i) for i in p.d]..., "")
return AutSymbol(id, 1, PermAut(p)) return AutSymbol(id, 1, PermAut(p))
end
end end
return id_autsymbol() return id_autsymbol()
end end
function perm_autsymbol(a::Vector{<:Integer}) function AutSymbol(a::Vector{<:Integer}, pow=1)
return perm_autsymbol(Generic.Perm(Vector{Int8}(a), false)) return AutSymbol(Generic.Perm(convert(Vector{Int8}, a)), pow)
end end
ϱ(i::Integer, j::Integer, pow::Integer=1) = transvection_R(i, j, pow=pow)
λ(i::Integer, j::Integer, pow::Integer=1) = transvection_L(i, j, pow=pow)
ε(i::Integer, pow::Integer=1) = flip(i, pow=pow)
σ(v, pow=1) = AutSymbol(v, pow=pow)
function domain(G::AutGroup{N}) where N function domain(G::AutGroup{N}) where N
F = G.objectGroup F = G.objectGroup
gg = gens(F) gg = gens(F)
@ -168,17 +169,16 @@ function AutGroup(G::FreeGroup; special=false)
indexing = [[i,j] for i in 1:n for j in 1:n if i≠j] indexing = [[i,j] for i in 1:n for j in 1:n if i≠j]
rmuls = [rmul_autsymbol(i,j) for (i,j) in indexing] rmuls = [transvection_R(i,j) for (i,j) in indexing]
lmuls = [lmul_autsymbol(i,j) for (i,j) in indexing] lmuls = [transvection_L(i,j) for (i,j) in indexing]
append!(S, [rmuls; lmuls]) append!(S, [rmuls; lmuls])
if !special if !special
flips = [flip_autsymbol(i) for i in 1:n] flips = [flip(i) for i in 1:n]
syms = [perm_autsymbol(p) for p in PermutationGroup(n)][2:end] syms = [AutSymbol(p) for p in PermutationGroup(Int8(n))][2:end]
append!(S, [flips; syms]) append!(S, [flips; syms])
end end
return AutGroup{n}(G, S) return AutGroup{n}(G, S)
end end
@ -291,18 +291,17 @@ function change_pow(s::AutSymbol, n::Integer)
end end
symbol = s.fn symbol = s.fn
if symbol isa FlipAut if symbol isa FlipAut
return flip_autsymbol(symbol.i, pow=n) return flip(symbol.i, n)
elseif symbol isa PermAut elseif symbol isa PermAut
return perm_autsymbol(symbol.perm, pow=n) return AutSymbol(symbol.perm, n)
elseif symbol isa RTransvect elseif symbol isa RTransvect
return rmul_autsymbol(symbol.i, symbol.j, pow=n) return transvection_R(symbol.i, symbol.j, n)
elseif symbol isa LTransvect elseif symbol isa LTransvect
return lmul_autsymbol(symbol.i, symbol.j, pow=n) return transvection_L(symbol.i, symbol.j, n)
elseif symbol isa Identity elseif symbol isa Identity
return s return s
else else
warn("Changing power of an unknown type of symbol! $s") throw(DomainError("Unknown type of AutSymbol: $s"))
return AutSymbol(s.id, n, s.fn)
end end
end end