1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-03 17:56:28 +01:00

faster versions of * and inv for products of rings

This commit is contained in:
kalmar 2017-07-21 16:04:45 +02:00
parent 6f08259466
commit 6fa01d87ef

View File

@ -170,7 +170,7 @@ function *{T<:RingElem}(g::DirectProductGroupElem{T}, h::DirectProductGroupElem{
if check
parent(g) == parent(h) || throw("Can not multiply elements of different groups!")
end
return DirectProductGroupElem([a+b for (a,b) in zip(g.elts,h.elts)])
return DirectProductGroupElem(g.elts + h.elts)
end
###############################################################################
@ -189,7 +189,7 @@ function inv{T<:GroupElem}(g::DirectProductGroupElem{T})
end
function inv{T<:RingElem}(g::DirectProductGroupElem{T})
return DirectProductGroupElem([-a for a in g.elts])
return DirectProductGroupElem(-g.elts)
end
###############################################################################