1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-07-17 19:00:33 +02: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 if check
parent(g) == parent(h) || throw("Can not multiply elements of different groups!") parent(g) == parent(h) || throw("Can not multiply elements of different groups!")
end end
return DirectProductGroupElem([a+b for (a,b) in zip(g.elts,h.elts)]) return DirectProductGroupElem(g.elts + h.elts)
end end
############################################################################### ###############################################################################
@ -189,7 +189,7 @@ function inv{T<:GroupElem}(g::DirectProductGroupElem{T})
end end
function inv{T<:RingElem}(g::DirectProductGroupElem{T}) function inv{T<:RingElem}(g::DirectProductGroupElem{T})
return DirectProductGroupElem([-a for a in g.elts]) return DirectProductGroupElem(-g.elts)
end end
############################################################################### ###############################################################################