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
1 changed files with 2 additions and 2 deletions

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
###############################################################################