From 7390f4699e682d76fdc1bc6973fb37d84dbe234a Mon Sep 17 00:00:00 2001 From: kalmar Date: Wed, 19 Jul 2017 22:15:47 +0200 Subject: [PATCH] add check::Bool=true to add(::GroupRingElem, ::GroupRingElem) --- src/GroupRings.jl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index 41bac97..585f676 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -300,16 +300,18 @@ function addeq!{T}(X::GroupRingElem{T}, Y::GroupRingElem{T}) return X end -function add{T<:Number}(X::GroupRingElem{T}, Y::GroupRingElem{T}) - parent(X) == parent(Y) || throw(ArgumentError( - "Elements don't seem to belong to the same Group Ring!")) +function add{T<:Number}(X::GroupRingElem{T}, Y::GroupRingElem{T}, check::Bool=true) + if check + parent(X) == parent(Y) || throw("Elements don't seem to belong to the same Group Ring!") + end return GroupRingElem(X.coeffs+Y.coeffs, parent(X)) end function add{T<:Number, S<:Number}(X::GroupRingElem{T}, - Y::GroupRingElem{S}) - parent(X) == parent(Y) || throw(ArgumentError( - "Elements don't seem to belong to the same Group Ring!")) + Y::GroupRingElem{S}, check::Bool=true) + if check + parent(X) == parent(Y) || throw("Elements don't seem to belong to the same Group Ring!") + end warn("Adding elements with different base rings!") return GroupRingElem(+(promote(X.coeffs, Y.coeffs)...), parent(X)) end