1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-09-13 08:25:39 +02:00

rewrite simplifyperms! in the new word api

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

View File

@ -335,31 +335,22 @@ end
# #
############################################################################### ###############################################################################
function getperm(s::AutSymbol) getperm(s::AutSymbol) = s.fn.perm^s.pow
if s.pow != 1
@warn("Power for perm_symbol should be never 0!")
return s.fn.perm^s.pow
else
return s.fn.perm
end
end
function simplifyperms!(W::Automorphism{N}) where N function simplifyperms!(::Type{Bool}, w::Automorphism{N}) where N
reduced = true reduced = true
to_delete = Int[] for i in 1:syllablelength(w)-1
for i in 1:length(W.symbols)-1 s, ns = syllables(w)[i], syllables(w)[i+1]
if W.symbols[i].pow == 0 if isone(s)
continue continue
elseif W.symbols[i].fn isa PermAut && W.symbols[i+1].fn isa PermAut elseif s.fn isa PermAut && ns.fn isa PermAut
reduced = false reduced = false
c = W.symbols[i] setmodified!(w)
n = W.symbols[i+1] syllables(w)[i+1] = AutSymbol(getperm(s)*getperm(ns))
W.symbols[i+1] = perm_autsymbol(getperm(c)*getperm(n)) syllables(w)[i] = change_pow(s, 0)
push!(to_delete, i)
end end
end end
deleteat!(W.symbols, to_delete) filter!(!isone, syllables(w))
deleteids!(W)
return reduced return reduced
end end