1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-09-05 06:45:40 +02:00

reparametrise parent call overloads

This commit is contained in:
kalmar 2017-06-06 00:03:38 +02:00
parent 43d78c97f8
commit 4b86d5d075

View File

@ -112,23 +112,23 @@ end
# #
############################################################################### ###############################################################################
function (RG::GroupRing)(T::Type=Int) function {Gr,T}(RG::GroupRing{Gr,T})(S::Type=Int)
isdefined(RG, :basis) || throw("Complete the definition of GroupRing first") isdefined(RG, :basis) || throw("Complete the definition of GroupRing first")
return GroupRingElem(spzeros(T,length(RG.basis)), RG) return GroupRingElem(spzeros(S,length(RG.basis)), RG)
end end
function (RG::GroupRing)(g::GroupElem, T::Type=Int) function {Gr,T}(RG::GroupRing{Gr,T})(g::GroupElem, S::Type=Int)
g = try g = try
RG.group(g) RG.group(g)
catch catch
throw("Can't coerce $g to the underlying group of $RG") throw("Can't coerce $g to the underlying group of $RG")
end end
result = RG(T) result = RG(S)
result[g] = one(T) result[g] = one(S)
return result return result
end end
function (RG::GroupRing)(x::AbstractVector) function {Gr,T}(RG::GroupRing{Gr,T})(x::AbstractVector)
length(x) == length(RG.basis) || throw("Can not coerce to $RG: lengths differ") length(x) == length(RG.basis) || throw("Can not coerce to $RG: lengths differ")
result = RG(eltype(x)) result = RG(eltype(x))
result.coeffs = x result.coeffs = x