mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2025-01-01 11:45:28 +01:00
fix multiple dispatch of scalar *
This commit is contained in:
parent
962a9e6e73
commit
35fc74e6f2
@ -247,17 +247,18 @@ end
|
|||||||
|
|
||||||
(-)(X::GroupRingElem) = GroupRingElem(-X.coeffs, parent(X))
|
(-)(X::GroupRingElem) = GroupRingElem(-X.coeffs, parent(X))
|
||||||
|
|
||||||
(*){T<:Number}(a::T, X::GroupRingElem{T}) = GroupRingElem(a*X.coeffs, parent(X))
|
mul{T<:Number}(a::T, X::GroupRingElem{T}) = GroupRingElem(a*X.coeffs, parent(X))
|
||||||
|
|
||||||
function (*){T<:Number, S<:Number}(a::T, X::GroupRingElem{S})
|
function mul{T<:Number, S<:Number}(a::T, X::GroupRingElem{S})
|
||||||
promote_type(T,S) == S || warn("Scalar and coeffs are in different rings! Promoting result to $(promote_type(T,S))")
|
promote_type(T,S) == S || warn("Scalar and coeffs are in different rings! Promoting result to $(promote_type(T,S))")
|
||||||
return GroupRingElem(a*X.coeffs, parent(X))
|
return GroupRingElem(a*X.coeffs, parent(X))
|
||||||
end
|
end
|
||||||
|
|
||||||
(*)(X::GroupRingElem, a) = a*X
|
(*)(a, X::GroupRingElem) = mul(a,X)
|
||||||
|
(*)(X::GroupRingElem, a) = mul(a,X)
|
||||||
|
|
||||||
# disallow Nemo.Rings to hijack *(::Integer, ::RingElem)
|
# disallow Nemo.Rings to hijack *(::Integer, ::RingElem)
|
||||||
(*){T<:Integer}(a::T, X::GroupRingElem) = a*X
|
(*){T<:Integer}(a::T, X::GroupRingElem) = mul(a,X)
|
||||||
|
|
||||||
(/)(X::GroupRingElem, a) = 1/a*X
|
(/)(X::GroupRingElem, a) = 1/a*X
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user