in mul! promote to the common type only if necessary
This commit is contained in:
parent
4e213c691d
commit
b40b9f94eb
|
@ -340,11 +340,14 @@ function mul!{T}(result::GroupRingElem{T}, X::GroupRingElem{T}, Y::GroupRingElem
|
||||||
end
|
end
|
||||||
|
|
||||||
function mul!(result::GroupRingElem, X::GroupRingElem, Y::GroupRingElem)
|
function mul!(result::GroupRingElem, X::GroupRingElem, Y::GroupRingElem)
|
||||||
S, T, U = eltype(result), eltype(X), eltype(U)
|
S, T, U = eltype(result), eltype(X), eltype(Y)
|
||||||
TT = promote_type(S, T, U)
|
TT = promote_type(S, T, U)
|
||||||
|
if S != TT || T != TT || U != TT
|
||||||
warn("Types $S, $T, $U are not the same, promoting the result to $TT")
|
warn("Types $S, $T, $U are not the same, promoting the result to $TT")
|
||||||
|
result.coeffs = convert(Array{TT},result.coeffs)
|
||||||
|
end
|
||||||
result = deepcopy(result)
|
result = deepcopy(result)
|
||||||
mul!(convert(Array{TT},result.coeffs), convert(Array{TT}, X.coeffs), convert(Array{TT}, Y.coeffs), parent(X).pm)
|
mul!(result.coeffs, convert(Array{TT}, X.coeffs), convert(Array{TT}, Y.coeffs), parent(X).pm)
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue