mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-12-25 18:15:29 +01:00
fix coercion to FPGroup
This commit is contained in:
parent
7d95338e33
commit
622f5bc6b3
@ -57,20 +57,15 @@ function (G::FPGroup)(w::GWord)
|
||||
return one(G)
|
||||
end
|
||||
|
||||
if eltype(w.symbols) == FreeSymbol
|
||||
w = FPGroupElem(FPSymbol.(w.symbols))
|
||||
@boundscheck for s in syllables(w)
|
||||
i = findfirst(g -> g.id == s.id, G.gens)
|
||||
i == 0 && throw(DomainError("Symbol $s does not belong to $G."))
|
||||
s.pow % G.gens[i].pow != 0 && throw(
|
||||
DomainError("Symbol $s doesn't belong to $G."))
|
||||
end
|
||||
|
||||
if eltype(w.symbols) == FPSymbol
|
||||
for s in w.symbols
|
||||
i = findfirst(g -> g.id == s.id, G.gens)
|
||||
i == 0 && throw(DomainError(
|
||||
"Symbol $s does not belong to $G."))
|
||||
s.pow % G.gens[i].pow == 0 || throw(DomainError(
|
||||
"Symbol $s doesn't belong to $G."))
|
||||
end
|
||||
end
|
||||
w.parent = G
|
||||
w = FPGroupElem(FPSymbol.(syllables(w)))
|
||||
setparent!(w, G)
|
||||
return reduce!(w)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user