From d603bbd329c372935fb8491aa40ac3cab3466b40 Mon Sep 17 00:00:00 2001 From: kalmar Date: Mon, 17 Jul 2017 10:18:26 +0200 Subject: [PATCH] cut on allocating another GrupRingElement --- src/Projections.jl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Projections.jl b/src/Projections.jl index 93b9816..12e1c3d 100644 --- a/src/Projections.jl +++ b/src/Projections.jl @@ -95,15 +95,17 @@ end # ############################################################################### -function central_projection(RG::GroupRing, char::Function, T::Type=Rational{Int}) +function central_projection(RG::GroupRing, chi::Function, T::Type=Rational{Int}) result = RG(T) result.coeffs = full(result.coeffs) - for g in RG.basis - result[g] = char(g) - end - dim = result[RG.group()] + dim = chi(RG.group()) ord = Int(order(RG.group)) - return convert(T, (dim//ord)*result) + + for g in RG.basis + result[g] = convert(T, (dim//ord)*chi(g)) + end + + return result) end function rankOne_projections(G::PermutationGroup, T::Type=Rational{Int})