From 038ece45c529bd93ca7f182fe2e16d456292d318 Mon Sep 17 00:00:00 2001 From: kalmar Date: Thu, 11 May 2017 18:09:39 +0200 Subject: [PATCH] no arithmetic of GSymbols; --- src/Groups.jl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Groups.jl b/src/Groups.jl index 401a888..9a84622 100644 --- a/src/Groups.jl +++ b/src/Groups.jl @@ -237,9 +237,13 @@ function replace!(W::GWord, index, toreplace::GWord, replacement::GWord; asserts @assert is_subsymbol(toreplace.symbols[end], W.symbols[index+n-1]) end - first = W.symbols[index]*inv(toreplace.symbols[1]) - last = W.symbols[index+n-1]*inv(toreplace.symbols[end]) - replacement = first*replacement*last + first = change_pow(W.symbols[index], + W.symbols[index].pow - toreplace.symbols[1].pow) + + last = change_pow(W.symbols[index+n-1], + W.symbols[index+n-1].pow - toreplace.symbols[end].pow) + + replacement = first * replacement * last splice!(W.symbols, index:index+n-1, replacement.symbols) return reduce!(W) end