diff --git a/src/automorphism_groups.jl b/src/automorphism_groups.jl index 25ee5a1..3272b2a 100644 --- a/src/automorphism_groups.jl +++ b/src/automorphism_groups.jl @@ -152,3 +152,20 @@ function simplify_perms!(W::AutWord) deleteat!(W.symbols, find(x -> x.pow == 0, W.symbols)) return reduced end + +function reduce!(W::AutWord) + if length(W) < 2 + deleteat!(W.symbols, find(x -> x.pow == 0, W.symbols)) + else + reduced = false + while !reduced + reduced = join_free_symbols!(W) + reduced = simplify_perms!(W) + deleteat!(W.symbols, find(x -> x.pow == 0, W.symbols)) + end + end + + W.modified = false + W.savedhash = hash(W.symbols,hash(typeof(W))) + return W +end