mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2024-09-08 15:31:44 +02:00
new versions of * : for those with and those without basis
This commit is contained in:
parent
9d5790d6d3
commit
170903b430
@ -363,19 +363,18 @@ function mul!{T}(result::GroupRingElem{T}, X::GroupRingElem, Y::GroupRingElem)
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function mul!{T<:Number}(result::GroupRingElem{T}, X::GroupRingElem, Y::GroupRingElem)
|
function *{T<:Number}(X::GroupRingElem{T}, Y::GroupRingElem{T}, check::Bool=true)
|
||||||
if result === X
|
if check
|
||||||
result = deepcopy(result)
|
parent(X) == parent(Y) || throw("Elements don't seem to belong to the same Group Ring!")
|
||||||
end
|
end
|
||||||
|
if isdefined(parent(X), :basis)
|
||||||
TT = typeof(first(X.coeffs)*first(Y.coeffs))
|
result = parent(X)(similar(X.coeffs))
|
||||||
|
result = mul!(result, X, Y)
|
||||||
if TT != T
|
else
|
||||||
warn("Type of the result $T does not contain type of the product ($TT), promoting.")
|
result = similar(X.coeffs)
|
||||||
result = convert(TT, result)
|
result = mul!(result, X.coeffs, Y.coeffs, parent(X).pm)
|
||||||
|
result = GroupRingElem(result, parent(X))
|
||||||
end
|
end
|
||||||
|
|
||||||
mul!(result.coeffs, X.coeffs, Y.coeffs, parent(X).pm)
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -389,12 +388,17 @@ function *{T<:Number, S<:Number}(X::GroupRingElem{T}, Y::GroupRingElem{S}, check
|
|||||||
|
|
||||||
result = mul!(result, X, Y)
|
result = mul!(result, X, Y)
|
||||||
return result
|
return result
|
||||||
end
|
|
||||||
|
|
||||||
function mul(X::AbstractVector, Y::AbstractVector, pm::Array{Int,2})
|
if isdefined(parent(X), :basis)
|
||||||
T = promote_type(eltype(X), eltype(Y))
|
result = parent(X)(similar(X.coeffs))
|
||||||
result = zeros(T, X)
|
result = convert(TT, result)
|
||||||
mul!(result, Vector{T}(X), Vector{T}(Y), pm)
|
result = mul!(result, X, Y)
|
||||||
|
else
|
||||||
|
result = similar(X.coeffs)
|
||||||
|
result = convert(TT, result)
|
||||||
|
result = mul!(result, X.coeffs, Y.coeffs, parent(X).pm)
|
||||||
|
result = GroupRingElem(result, parent(X))
|
||||||
|
end
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user