From bc1063f0fdf9ea5ceaf310c6f086a3cf49ce3a2e Mon Sep 17 00:00:00 2001 From: kalmarek Date: Wed, 25 Mar 2020 00:27:47 +0100 Subject: [PATCH] use the new reduce for Automorphisms and FPWords --- src/AutGroup.jl | 17 ++++------------- src/FPGroups.jl | 14 ++++---------- 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/AutGroup.jl b/src/AutGroup.jl index 1c007a7..ceb9edf 100644 --- a/src/AutGroup.jl +++ b/src/AutGroup.jl @@ -361,20 +361,11 @@ function simplifyperms!(W::Automorphism{N}) where N return reduced end -function reduce!(W::Automorphism) - if length(W) == 0 - return W - elseif length(W.symbols) == 1 - deleteids!(W) - else - reduced = false - while !reduced - reduced = simplifyperms!(W) && freereduce!(W) - end +function reduce!(w::Automorphism) + reduced = false + while !reduced + reduced = simplifyperms!(Bool, w) && freereduce!(Bool, w) end - - W.modified = true - return W end diff --git a/src/FPGroups.jl b/src/FPGroups.jl index 440c6dd..878c4ba 100644 --- a/src/FPGroups.jl +++ b/src/FPGroups.jl @@ -134,17 +134,11 @@ end (*)(s::FPSymbol, W::FPGroupElem) = l_multiply(W, [s]) function reduce!(W::FPGroupElem) - if length(W) < 2 - deleteat!(W.symbols, findall(x -> x.pow == 0, W.symbols)) - else - reduced = false - while !reduced - reduced = freereduce!(W) || replace_all!(W, parent(W).rels) - end + reduced = false + while !reduced + W = replace(W, parent(W).rels) + reduced = freereduce!(Bool, W) end - - W.savedhash = hash(W.symbols, hash(typeof(W))) - W.modified = false return W end