mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-09-08 15:31:44 +02: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
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user