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
@ -53,25 +53,20 @@ FPGroup(H::FreeGroup) = FPGroup([FPSymbol(s) for s in H.gens])
|
|||||||
#
|
#
|
||||||
|
|
||||||
function (G::FPGroup)(w::GWord)
|
function (G::FPGroup)(w::GWord)
|
||||||
if isempty(w)
|
if isempty(w)
|
||||||
return one(G)
|
return one(G)
|
||||||
end
|
end
|
||||||
|
|
||||||
if eltype(w.symbols) == FreeSymbol
|
@boundscheck for s in syllables(w)
|
||||||
w = FPGroupElem(FPSymbol.(w.symbols))
|
i = findfirst(g -> g.id == s.id, G.gens)
|
||||||
end
|
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
|
w = FPGroupElem(FPSymbol.(syllables(w)))
|
||||||
for s in w.symbols
|
setparent!(w, G)
|
||||||
i = findfirst(g -> g.id == s.id, G.gens)
|
return reduce!(w)
|
||||||
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
|
|
||||||
return reduce!(w)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
(G::FPGroup)(s::GSymbol) = G(FPGroupElem(s))
|
(G::FPGroup)(s::GSymbol) = G(FPGroupElem(s))
|
||||||
|
Loading…
Reference in New Issue
Block a user