mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-12-29 11:00:28 +01:00
add check::Bool=true to add(::GroupRingElem, ::GroupRingElem)
This commit is contained in:
parent
f939a2ae27
commit
7390f4699e
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user