mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-11-19 06:30:29 +01:00
rename freegroup_reduce → reduce
This commit is contained in:
parent
c3ee520521
commit
e98784bd98
@ -78,7 +78,7 @@ function join_free_symbols!(W::GWord)
|
||||
return reduced
|
||||
end
|
||||
|
||||
function freegroup_reduce!{T}(W::GWord{T})
|
||||
function reduce!{T}(W::GWord{T})
|
||||
if length(W) < 2
|
||||
deleteat!(W.symbols, find(x -> x.pow == 0, W.symbols))
|
||||
else
|
||||
@ -94,16 +94,16 @@ function freegroup_reduce!{T}(W::GWord{T})
|
||||
return W
|
||||
end
|
||||
|
||||
freegroup_reduce(W::GWord) = freegroup_reduce!(deepcopy(W))
|
||||
reduce(W::GWord) = reduce!(deepcopy(W))
|
||||
|
||||
function hash{T}(W::GWord{T}, h::UInt)
|
||||
W.modified && freegroup_reduce!(W)
|
||||
W.modified && reduce!(W)
|
||||
return W.savedhash + h
|
||||
end
|
||||
|
||||
function (==){T}(W::GWord{T}, Z::GWord{T})
|
||||
W.modified && freegroup_reduce!(W) # reduce clears the flag and recalculate the hash
|
||||
Z.modified && freegroup_reduce!(Z)
|
||||
W.modified && reduce!(W) # reduce clears the flag and recalculate the hash
|
||||
Z.modified && reduce!(Z)
|
||||
return W.savedhash == Z.savedhash && W.symbols == Z.symbols
|
||||
end
|
||||
|
||||
@ -123,7 +123,7 @@ function r_multiply!(W::GWord, x; reduced::Bool=true)
|
||||
push!(W.symbols, x...)
|
||||
end
|
||||
if reduced
|
||||
freegroup_reduce!(W)
|
||||
reduce!(W)
|
||||
end
|
||||
return W
|
||||
end
|
||||
@ -133,7 +133,7 @@ function l_multiply!(W::GWord, x; reduced::Bool=true)
|
||||
unshift!(W.symbols, reverse(x)...)
|
||||
end
|
||||
if reduced
|
||||
freegroup_reduce!(W)
|
||||
reduce!(W)
|
||||
end
|
||||
return W
|
||||
end
|
||||
@ -221,8 +221,7 @@ function replace!(W::GWord, index, toreplace::GWord, replacement::GWord; asserts
|
||||
last = W.symbols[index+n-1]*inv(toreplace.symbols[end])
|
||||
replacement = first*replacement*last
|
||||
splice!(W.symbols, index:index+n-1, replacement.symbols)
|
||||
Groups.freegroup_reduce!(W)
|
||||
return W
|
||||
return reduce!(W)
|
||||
end
|
||||
|
||||
function replace(W::GWord, index, toreplace::GWord, replacement::GWord)
|
||||
|
@ -69,14 +69,14 @@ end
|
||||
@test one(FGWord) == one(s)*one(s)
|
||||
w = GWord{FGSymbol}([s])
|
||||
push!(w.symbols, (s^-1).symbols[1])
|
||||
@test Groups.freegroup_reduce!(w) == one(FGWord)
|
||||
@test Groups.reduce!(w) == one(FGWord)
|
||||
o = (t*s)^3
|
||||
@test o == t*s*t*s*t*s
|
||||
p = (t*s)^-3
|
||||
@test p == s^-1*t^-1*s^-1*t^-1*s^-1*t^-1
|
||||
@test o*p == one(FGWord)
|
||||
w = FGWord([o.symbols..., p.symbols...])
|
||||
@test Groups.freegroup_reduce!(w).symbols ==Vector{FGSymbol}([])
|
||||
@test Groups.reduce!(w).symbols ==Vector{FGSymbol}([])
|
||||
end
|
||||
@testset "arithmetic" begin
|
||||
@test Groups.r_multiply!(FGWord(t),[s,t]; reduced=true) == t*s*t
|
||||
|
Loading…
Reference in New Issue
Block a user