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

overload reduce function for AutWords

This commit is contained in:
kalmar 2017-01-31 16:59:10 +01:00
parent e98784bd98
commit 5bfd4858a0

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