1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-05 02:11:27 +01:00

don't compute G.N(p.n) and G.P(g.p) twice when coercing

This commit is contained in:
kalmar 2017-07-21 13:37:28 +02:00
parent 4fa7d744c2
commit 06a4e50a2d

View File

@ -68,18 +68,18 @@ parent(g::WreathProductElem) = WreathProduct(parent(g.n[1]), parent(g.p))
############################################################################### ###############################################################################
function (G::WreathProduct)(g::WreathProductElem) function (G::WreathProduct)(g::WreathProductElem)
try n = try
G.N(g.n) G.N(g.n)
catch catch
throw("Can't coerce $(g.n) to $(G.N) factor of $G") throw("Can't coerce $(g.n) to $(G.N) factor of $G")
end end
try p = try
G.P(g.p) G.P(g.p)
catch catch
throw("Can't coerce $(g.p) to $(G.P) factor of $G") throw("Can't coerce $(g.p) to $(G.P) factor of $G")
end end
elt = WreathProductElem(G.N(g.n), G.P(g.p)) elt = WreathProductElem(n, p)
elt.parent = G # elt.parent = G
return elt return elt
end end