Skip to content

Commit

Permalink
derive _int_type of ActionHomomorphisms from action (which is easily …
Browse files Browse the repository at this point in the history
…user-definable)

* also bump the default to UInt32, as we are hitting the limits
of UInt16 already ;)
  • Loading branch information
kalmarek committed Nov 15, 2023
1 parent 02fad62 commit 01f4f03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/ext_homomorphisms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ PermutationGroups.degree(hom::InducedActionHomomorphism) = length(basis(hom))

coeff_type(hom::InducedActionHomomorphism) = coeff_type(action(hom))
_int_type(::Type{<:StarAlgebras.AbstractBasis{T,I}}) where {T,I} = I
_int_type(hom::InducedActionHomomorphism) = _int_type(typeof(basis(hom)))
_int_type(basis::StarAlgebras.AbstractBasis) = _int_type(typeof(basis))
_int_type(hom::InducedActionHomomorphism) = _int_type(basis(hom))

# Exceeding typemax(UInt32) here would mean e.g. that you're trying to block-diagonalize
# an SDP constraint of size 4_294_967_295 × 4_294_967_295, which is highly unlikely ;)
_int_type(::Type{<:Action}) = UInt32
_int_type(ac::Action) = _int_type(typeof(ac))

# Exceeding typemax(UInt16) here would mean e.g. that you're trying to block-diagonalize
# an SDP constraint of size 65535×65535, which is highly unlikely ;)
_int_type(::Type{<:InducedActionHomomorphism}) = UInt16

function induce(hom::InducedActionHomomorphism, g::GroupElement)
return induce(action(hom), hom, g)
Expand All @@ -43,7 +46,7 @@ end

function ExtensionHomomorphism(action::Action, basis)
return ExtensionHomomorphism(
_int_type(ExtensionHomomorphism),
_int_type(action),
action,
basis,
)
Expand Down Expand Up @@ -104,7 +107,7 @@ function CachedExtensionHomomorphism(
precompute = false,
)
return CachedExtensionHomomorphism(
_int_type(ExtensionHomomorphism),
_int_type(action),
G,
action,
basis;
Expand Down
2 changes: 1 addition & 1 deletion test/action_permutation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ end
precompute = true,
)
@test all(g keys(ehom.cache) for g in G) # we actually cached
@test typeof(SymbolicWedderburn.induce(ehom, one(G))) == Perm{UInt16}
@test typeof(SymbolicWedderburn.induce(ehom, one(G))) == Perm{UInt32} # the default

ψ = SymbolicWedderburn.action_character(ehom, tbl)
@test SymbolicWedderburn.constituents(ψ) == [40, 22, 18]
Expand Down

0 comments on commit 01f4f03

Please sign in to comment.