From c056c99c1f33d96ee05571796706a82c37dc3950 Mon Sep 17 00:00:00 2001 From: kalmar Date: Wed, 12 Jul 2017 20:15:09 +0200 Subject: [PATCH] use dictionary for characters values --- src/Projections.jl | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/Projections.jl b/src/Projections.jl index da9922e..436d816 100644 --- a/src/Projections.jl +++ b/src/Projections.jl @@ -19,31 +19,29 @@ function chars(G::PermutationGroup) χ_regsgn(σ::Nemo.perm) = sign(σ)*χ_reg(σ) - function χ_regviaS3(σ::Nemo.perm) - @assert parent(σ).n == 4 - t = permtype(σ) - if t == [1,1,1,1] - result = 2 - elseif t == [2,2] - result = 2 - elseif t == [1,3] - result = -1 - else - result = 0 - end - return result - end - - chars = [χ_id, χ_sgn, χ_regviaS3, χ_reg, χ_regsgn] - if G.n == 1 - return chars[1:1] + return [χ_id] + elseif G.n == 2 - return chars[1:2] + return [χ_id, χ_sgn] + elseif G.n == 3 - return [chars[1:2]..., chars[4]] + return [χ_id, χ_sgn, χ_reg] + elseif G.n == 4 - return chars[1:5] + + function χ_regviaS3(σ::Nemo.perm) + vals = Dict{Vector{Int}, Int}( + [1,1,1,1] => 2, + [1,1,2] => 0, + [2,2] => 2, + [1,3] =>-1, + [4] => 0 + ) + return vals[permtype(σ)] + end + + return [χ_id, χ_sgn, χ_regviaS3, χ_reg, χ_regsgn] else throw("Characters for $G unknown!") end