mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2025-01-01 03:40:29 +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
|
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