From 5c2fabfb0827fabfcaa135c6c4a069e14997b475 Mon Sep 17 00:00:00 2001 From: kalmar Date: Wed, 19 Jul 2017 22:38:17 +0200 Subject: [PATCH] make another version of mul! for GroupRingElts --- src/GroupRings.jl | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index ad7d948..9bfd581 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -335,12 +335,23 @@ function mul!{T}(result::AbstractVector{T}, end end -function mul!{T}(result::GroupRingElem{T}, X::GroupRingElem{T}, Y::GroupRingElem{T}) - # @show result === X +function mul!{T}(result::GroupRingElem{T}, X::GroupRingElem, Y::GroupRingElem) if result === X result = deepcopy(result) end - mul!(result.coeffs, X.coeffs, Y.coeffs, parent(X).pm) + + z = zero(T) + result.coeffs .= z + + for j in eachindex(Y.coeffs) + if Y.coeffs[j] != z + for i in eachindex(X.coeffs) + if X.coeffs[i] != z + result.coeffs[parent(X).pm[i,j]] += X[i]*Y[j] + end + end + end + end return result end