1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-11-19 06:30:29 +01:00

fix simplify_perms! → simplifyperms!

Currently it passes twice over W.symbols, but should be correct
This commit is contained in:
kalmarek 2018-04-02 18:18:12 +02:00
parent f9ede91343
commit 3ff1f1897e

View File

@ -329,8 +329,9 @@ function getperm(s::AutSymbol)
end
end
function simplify_perms!(W::Automorphism{N}) where N
function simplifyperms!(W::Automorphism{N}) where N
reduced = true
to_delete = Int[]
for i in 1:length(W.symbols)-1
if W.symbols[i].pow == 0
continue
@ -338,10 +339,11 @@ function simplify_perms!(W::Automorphism{N}) where N
reduced = false
c = W.symbols[i]
n = W.symbols[i+1]
p = (getperm(c)*getperm(n)).d
W.symbols[i+1].typ.perm.d = p
W.symbols[i+1] = perm_autsymbol(getperm(c)*getperm(n))
push!(to_delete, i)
end
end
deleteat!(W.symbols, to_delete)
deleteids!(W)
return reduced
end
@ -349,13 +351,12 @@ end
function reduce!(W::Automorphism)
if length(W) == 0
return W
elseif length(W)< 2
W.modified = true
elseif length(W.symbols) == 1
deleteids!(W)
else
reduced = false
while !reduced
reduced = simplify_perms!(W) && free_reduce!(W)
reduced = simplifyperms!(W) && free_reduce!(W)
end
end