overload reduce function for AutWords

This commit is contained in:
kalmar 2017-01-31 16:59:10 +01:00
parent e98784bd98
commit 5bfd4858a0
1 changed files with 17 additions and 0 deletions

View File

@ -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