From 02fad62f8180ded4c36c3b174689577c29a7a93a Mon Sep 17 00:00:00 2001 From: Marek Kaluba Date: Mon, 13 Nov 2023 17:50:14 +0100 Subject: [PATCH] allow specifying index type for CachedExtensionHomomorphism --- src/ext_homomorphisms.jl | 20 ++++++++++++++++++-- test/action_permutation.jl | 11 +++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/ext_homomorphisms.jl b/src/ext_homomorphisms.jl index 0e8171d..f103534 100644 --- a/src/ext_homomorphisms.jl +++ b/src/ext_homomorphisms.jl @@ -78,12 +78,13 @@ StarAlgebras.basis(h::CachedExtensionHomomorphism) = basis(h.ehom) action(h::CachedExtensionHomomorphism) = action(h.ehom) function CachedExtensionHomomorphism( + ::Type{I}, G::Group, action::Action, basis; precompute = false, -) - hom = ExtensionHomomorphism(action, basis) +) where {I} + hom = ExtensionHomomorphism(I, action, basis) S = typeof(induce(hom, one(G))) chom = CachedExtensionHomomorphism{eltype(G),S}(hom) @sync if precompute @@ -96,6 +97,21 @@ function CachedExtensionHomomorphism( return chom end +function CachedExtensionHomomorphism( + G::Group, + action::Action, + basis; + precompute = false, +) + return CachedExtensionHomomorphism( + _int_type(ExtensionHomomorphism), + G, + action, + basis; + precompute = precompute, + ) +end + function induce(ac::Action, chom::CachedExtensionHomomorphism, g::GroupElement) return _induce(ac, chom, g) end diff --git a/test/action_permutation.jl b/test/action_permutation.jl index 51aeed6..f80dec5 100644 --- a/test/action_permutation.jl +++ b/test/action_permutation.jl @@ -52,12 +52,23 @@ end action = OnLetters() tbl = SymbolicWedderburn.CharacterTable(Rational{Int}, G) ehom = SymbolicWedderburn.CachedExtensionHomomorphism( + Int32, G, action, words; precompute = true, ) @test all(g ∈ keys(ehom.cache) for g in G) # we actually cached + @test typeof(SymbolicWedderburn.induce(ehom, one(G))) == Perm{Int32} + + ehom = SymbolicWedderburn.CachedExtensionHomomorphism( + G, + action, + words; + precompute = true, + ) + @test all(g ∈ keys(ehom.cache) for g in G) # we actually cached + @test typeof(SymbolicWedderburn.induce(ehom, one(G))) == Perm{UInt16} ψ = SymbolicWedderburn.action_character(ehom, tbl) @test SymbolicWedderburn.constituents(ψ) == [40, 22, 18]