From 9e09317148e70f597b3b5eb1d653306759403962 Mon Sep 17 00:00:00 2001 From: kalmar Date: Thu, 27 Jul 2017 22:08:53 +0200 Subject: [PATCH] add specialisations for GroupRing over multiplicative Groups of Rings --- src/GroupRings.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index 1adf81b..d2cf331 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -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)