From 0fabd21e5348eedb8163e117d0df8ee026c8ba3f Mon Sep 17 00:00:00 2001 From: kalmarek Date: Tue, 3 Oct 2017 14:46:05 +0200 Subject: [PATCH] much faster Cstar_repr --- src/OrbitDecomposition.jl | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/OrbitDecomposition.jl b/src/OrbitDecomposition.jl index 5939361..91fa680 100644 --- a/src/OrbitDecomposition.jl +++ b/src/OrbitDecomposition.jl @@ -188,14 +188,10 @@ function reconstruct_sol{T<:GroupElem}(preps::Dict{T, Generic.perm}, return recP end -function Cstar_repr{T}(x::GroupRingElem{T}, mreps::Dict) - res = spzeros(size(mreps[first(keys(mreps))])...) - - for g in parent(x).basis - if x[g] != zero(T) - res .+= Float64(x[g]).*mreps[g] - end - end +function Cstar_repr(x::GroupRingElem{T}, mreps::Dict) where {T} + nzindx = [i for i in eachindex(x.coeffs) if x[i] != zero(T)] + RG = parent(x) + res = sum(Float64(x[i]).*mreps[RG.basis[i]] for i in nzindx) return res end