diff --git a/src/sa_basis.jl b/src/sa_basis.jl index 0403425..7c71ca1 100644 --- a/src/sa_basis.jl +++ b/src/sa_basis.jl @@ -1,22 +1,27 @@ function affordable_real( irreducible_characters, - multiplicities = fill(1, length(irreducible_characters)), + multiplicities, ) irr_real = similar(irreducible_characters, 0) mls_real = similar(multiplicities, 0) for (i, χ) in pairs(irreducible_characters) ι = Characters.frobenius_schur(χ) - if abs(ι) == 1 # real or quaternionic - @debug "real/quaternionic:" χ + if ι == 1 # real + @debug "real" χ push!(irr_real, χ) push!(mls_real, multiplicities[i]) - else # complex one... + elseif ι == -1 # quaternionic + @debug "quaternionic" χ + @assert iseven(multiplicities[i]) "Multiplicities of quaternionic character must be even." + push!(irr_real, 2 * χ) + push!(mls_real, div(multiplicities[i], 2)) + else # complex cχ = conj(χ) k = findfirst(==(cχ), irreducible_characters) - @assert k !== nothing + @assert k !== nothing "Conjugate character not found." @debug "complex" χ conj(χ) = irreducible_characters[k] - if k > i # ... we haven't already observed a conjugate of - @assert multiplicities[i] == multiplicities[k] + if k > i # we haven't already observed a conjugate + @assert multiplicities[i] == multiplicities[k] "Multiplicities of complex conjugates must be equal." push!(irr_real, χ + cχ) push!(mls_real, multiplicities[i]) end diff --git a/test/projections.jl b/test/projections.jl index eeaeefe..0890018 100644 --- a/test/projections.jl +++ b/test/projections.jl @@ -21,7 +21,7 @@ end G = PermGroup([perm"(1,2,3,4)"]) chars = let irr = SymbolicWedderburn.irreducible_characters(G) if !all(isreal, irr) - irr, _ = SymbolicWedderburn.affordable_real(irr) + irr, _ = SymbolicWedderburn.affordable_real(irr,fill(1, length(irr))) end SymbolicWedderburn.Character{Float64}.(irr) end @@ -64,3 +64,25 @@ end end end end + +@testset "affordable real all cases" begin + G = SmallPermGroups[24][3] # SL(2,3) + tbl = SymbolicWedderburn.CharacterTable(Rational{Int}, G) + chars = SymbolicWedderburn.irreducible_characters(tbl) + + @test SymbolicWedderburn.degree.(chars)==[1, 1, 1, 2, 2, 2, 3] + @test all(χ -> isone(dot(χ, χ)), chars) + chars_fl = SymbolicWedderburn.Character{ComplexF64}.(chars) + @test SymbolicWedderburn.degree.(chars_fl)==[1, 1, 1, 2, 2, 2, 3] + @test all(χ -> isapprox(dot(χ, χ), 1), chars_fl) + + + + charsR, _ = SymbolicWedderburn.affordable_real(chars,fill(2,length(chars))) + @test SymbolicWedderburn.degree.(charsR) == [1, 2, 4, 4, 3] + @test [dot(χ, χ) for χ in charsR] == [1, 2, 2, 4, 1] + + charsR_fl = SymbolicWedderburn.Character{Float64}.(charsR) + @test all( [1, 2, 4, 4, 3] .== SymbolicWedderburn.degree.(charsR_fl),) + @test all( [1, 2, 2, 4, 1].≈[dot(χ, χ) for χ in charsR_fl],) +end diff --git a/test/sa_basis.jl b/test/sa_basis.jl index dd43ee1..04663c2 100644 --- a/test/sa_basis.jl +++ b/test/sa_basis.jl @@ -9,7 +9,7 @@ @test all(isone ∘ SymbolicWedderburn.degree, chars_fl) @test all(χ -> isapprox(dot(χ, χ), 1), chars_fl) - charsR, _ = SymbolicWedderburn.affordable_real(chars) + charsR, _ = SymbolicWedderburn.affordable_real(chars,fill(1, length(chars))) @test SymbolicWedderburn.degree.(charsR) == [dot(χ, χ) for χ in charsR] == [1, 1, 2, 2, 2, 2]