1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-08-02 14:48:27 +02:00

add check::Bool=true to add(::GroupRingElem, ::GroupRingElem)

This commit is contained in:
kalmar 2017-07-19 22:15:47 +02:00
parent f939a2ae27
commit 7390f4699e

View File

@ -300,16 +300,18 @@ function addeq!{T}(X::GroupRingElem{T}, Y::GroupRingElem{T})
return X return X
end end
function add{T<:Number}(X::GroupRingElem{T}, Y::GroupRingElem{T}) function add{T<:Number}(X::GroupRingElem{T}, Y::GroupRingElem{T}, check::Bool=true)
parent(X) == parent(Y) || throw(ArgumentError( if check
"Elements don't seem to belong to the same Group Ring!")) 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)) return GroupRingElem(X.coeffs+Y.coeffs, parent(X))
end end
function add{T<:Number, S<:Number}(X::GroupRingElem{T}, function add{T<:Number, S<:Number}(X::GroupRingElem{T},
Y::GroupRingElem{S}) Y::GroupRingElem{S}, check::Bool=true)
parent(X) == parent(Y) || throw(ArgumentError( if check
"Elements don't seem to belong to the same Group Ring!")) parent(X) == parent(Y) || throw("Elements don't seem to belong to the same Group Ring!")
end
warn("Adding elements with different base rings!") warn("Adding elements with different base rings!")
return GroupRingElem(+(promote(X.coeffs, Y.coeffs)...), parent(X)) return GroupRingElem(+(promote(X.coeffs, Y.coeffs)...), parent(X))
end end