From 6fa01d87ef80e9b3dadb9a5f0eece7fb1aa8a239 Mon Sep 17 00:00:00 2001 From: kalmar Date: Fri, 21 Jul 2017 16:04:45 +0200 Subject: [PATCH] faster versions of * and inv for products of rings --- src/DirectProducts.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DirectProducts.jl b/src/DirectProducts.jl index 8bac17f..ffe9426 100644 --- a/src/DirectProducts.jl +++ b/src/DirectProducts.jl @@ -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 ###############################################################################