From 8463b928cbe4c24dabd9c87617ba2acebb091ccb Mon Sep 17 00:00:00 2001 From: kalmar Date: Mon, 10 Jul 2017 19:26:44 +0200 Subject: [PATCH] add RG(i::Int) = i*(id) function --- src/GroupRings.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index 51f29f6..f5e326a 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -113,6 +113,11 @@ end # ############################################################################### +zero(RG::GroupRing, T::Type=Int) = RG(T) +one(RG::GroupRing, T::Type=Int) = RG(RG.group(), T) + +(RG::GroupRing)(i::Int, T::Type=Int) = i*one(RG, T) + function (RG::GroupRing)(T::Type=Int) isdefined(RG, :basis) || throw("Complete the definition of GroupRing first") return GroupRingElem(spzeros(T,length(RG.basis)), RG) @@ -187,9 +192,6 @@ end eltype(X::GroupRingElem) = eltype(X.coeffs) -one(RG::GroupRing) = RG(RG.group()) -zero(RG::GroupRing) = RG() - ############################################################################### # # String I/O