1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-12-29 11:00:28 +01:00

add specialisations for GroupRing over multiplicative Groups of Rings

This commit is contained in:
kalmar 2017-07-27 22:08:53 +02:00
parent ddaef73872
commit 9e09317148

View File

@ -110,6 +110,7 @@ end
zero(RG::GroupRing, T::Type=Int) = RG(T)
one(RG::GroupRing, T::Type=Int) = RG(RG.group(), T)
one{R<:Nemo.Ring, S<:Nemo.RingElem}(RG::GroupRing{R,S}) = RG(eye(RG.group()))
function (RG::GroupRing)(i::Int, T::Type=Int)
elt = RG(T)
@ -117,6 +118,12 @@ function (RG::GroupRing)(i::Int, T::Type=Int)
return elt
end
function (RG::GroupRing{R,S}){R<:Ring, S}(i::Int, T::Type=Int)
elt = RG(T)
elt[eye(RG.group())] = i
return elt
end
function (RG::GroupRing)(T::Type=Int)
isdefined(RG, :basis) || throw("Can not coerce without basis of GroupRing")
return GroupRingElem(spzeros(T,length(RG.basis)), RG)