From e78da236bdb052f760c2bc04a93327b87a8daf6b Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Fri, 17 Nov 2023 08:57:58 +0000 Subject: [PATCH] Fix identity rep (#4) * Fix identity representation * Update NumericalRepresentationTheory.jl * Update Project.toml --- Project.toml | 2 +- src/NumericalRepresentationTheory.jl | 10 ++++++++-- test/runtests.jl | 18 ++++++++++++------ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Project.toml b/Project.toml index ce46da8..4db3d8a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "NumericalRepresentationTheory" uuid = "6b7c1d51-ecee-4149-97a8-50646b514dce" authors = ["Sheehan Olver "] -version = "0.1.0" +version = "0.1.1" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/src/NumericalRepresentationTheory.jl b/src/NumericalRepresentationTheory.jl index 448f36c..cc42343 100644 --- a/src/NumericalRepresentationTheory.jl +++ b/src/NumericalRepresentationTheory.jl @@ -287,8 +287,14 @@ diagm(A::Vector{<:Representation}) = Representation(blockdiag.(generators.(A)... ⊕(A::Representation...) = Representation(blockdiag.(generators.(A)...)) -(R::Representation)(P::AbstractPermutation) = - *(map(i -> R.generators[i], CoxeterDecomposition(P).terms)...) +function (R::Representation)(P::AbstractPermutation) + if isempty(CoxeterDecomposition(P).terms) + # Identity + one(first(R.generators)) + else + *(map(i -> R.generators[i], CoxeterDecomposition(P).terms)...) + end +end # determine multiplicities of eigs on diagonal, assuming sorted function eigmults(λ::Vector{Int}) diff --git a/test/runtests.jl b/test/runtests.jl index 9924429..28e28b2 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,4 @@ -using NumericalRepresentationTheory, LinearAlgebra, Test +using NumericalRepresentationTheory, Permutations, LinearAlgebra, Test import NumericalRepresentationTheory: gelfandbasis @testset "Representations" begin @@ -36,12 +36,18 @@ import NumericalRepresentationTheory: gelfandbasis @test multiplicities(ρ̃) == multiplicities(ρ) @test abs.(blockdiagonalize(ρ̃)[2]) ≈ abs.(Matrix(Q)) end + + @testset "Rico Bug" begin + ρ = Representation(2,1) + g = Permutation([1,2,3]) + @test ρ(g) == I(2) + end end -basis = gelfandbasis(Representation(Partition([3,2,1])).generators) -Λ = Matrix{Int}(undef, size(basis[1],1), length(basis)) -for k in axes(Λ,1), j in axes(Λ,2) - Λ[k,j] = round(Int,basis[j][k,k]) -end +# basis = gelfandbasis(Representation(Partition([3,2,1])).generators) +# Λ = Matrix{Int}(undef, size(basis[1],1), length(basis)) +# for k in axes(Λ,1), j in axes(Λ,2) +# Λ[k,j] = round(Int,basis[j][k,k]) +# end