From f2ad7c804511bf969a968ce00869461c7387b595 Mon Sep 17 00:00:00 2001 From: kalmar Date: Wed, 19 Jul 2017 22:43:46 +0200 Subject: [PATCH] new version of *, with optional check::Bool=true --- src/GroupRings.jl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index a41b9c6..2c40b1d 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -371,10 +371,15 @@ function mul!{T<:Number}(result::GroupRingElem{T}, X::GroupRingElem, Y::GroupRin return result end -function mul{T<:Number}(X::AbstractVector{T}, Y::AbstractVector{T}, - pm::Array{Int,2}) - result = zeros(X) - mul!(result, X, Y, pm) +function *{T<:Number, S<:Number}(X::GroupRingElem{T}, Y::GroupRingElem{S}, check::Bool=true) + if true + parent(X) == parent(Y) || throw("Elements don't seem to belong to the same Group Ring!") + end + + TT = typeof(first(X.coeffs)*first(Y.coeffs)) + warn("Multiplying elements with different base rings! Promoting the result to $TT.") + + result = mul!(result, X, Y) return result end