Skip to content

Commit

Permalink
Try to sort out the homs (#1488)
Browse files Browse the repository at this point in the history
* Try to sort out the homs

* Add deprecations

* chore: Bump version and AA compat
  • Loading branch information
lgoettgens authored May 3, 2024
1 parent c19f1c5 commit c9da9fa
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Hecke"
uuid = "3e1990a7-5d81-5526-99ce-9ba3ff248f21"
version = "0.31.2"
version = "0.31.3"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand Down Expand Up @@ -28,7 +28,7 @@ GAPExt = "GAP"
PolymakeExt = "Polymake"

[compat]
AbstractAlgebra = "^0.41.0"
AbstractAlgebra = "^0.41.3"
Dates = "1.6"
Distributed = "1.6"
GAP = "0.9.6, 0.10, 0.11"
Expand Down
3 changes: 3 additions & 0 deletions src/Deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,6 @@ end
@deprecate reduce_full(A::SMat{T}, g::SRow{T}, trafo::Type{Val{N}}) where {N, T} reduce_full(A, g, Val(N))
@deprecate gens(A::GroupAlgebra, return_full_basis::Type{Val{T}}) where T gens(A, Val(T))
@deprecate gens(A::AbstractAssociativeAlgebra, return_full_basis::Type{Val{T}}; thorough_search::Bool = false) where T gens(A, Val(T); thorough_search)

@deprecate hom(G::FinGenAbGroup, H::FinGenAbGroup, A::Matrix{ <: Map{FinGenAbGroup, FinGenAbGroup}}) hom_direct_sum(G, H, A)
@deprecate hom(G::FinGenAbGroup, H::FinGenAbGroup, A::Vector{ <: Map{FinGenAbGroup, FinGenAbGroup}}) hom_tensor(G, H, A)
28 changes: 24 additions & 4 deletions src/GrpAb/GrpAbFinGen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -840,13 +840,13 @@ function matrix(M::Generic.IdentityMap{FinGenAbGroup})
end

@doc raw"""
hom(G::FinGenAbGroup, H::FinGenAbGroup, A::Matrix{ <: Map{FinGenAbGroup, FinGenAbGroup}}) -> Map
hom_direct_sum(G::FinGenAbGroup, H::FinGenAbGroup, A::Matrix{ <: Map{FinGenAbGroup, FinGenAbGroup}}) -> Map
Given groups $G$ and $H$ that are created as direct products as well
as a matrix $A$ containing maps $A[i,j] : G_i \to H_j$, return
the induced homomorphism.
"""
function hom(G::FinGenAbGroup, H::FinGenAbGroup, A::Matrix{ <: Map{FinGenAbGroup, FinGenAbGroup}})
function hom_direct_sum(G::FinGenAbGroup, H::FinGenAbGroup, A::Matrix{ <: Map{FinGenAbGroup, FinGenAbGroup}})
r, c = size(A)
if c == 1
dG = [G]
Expand All @@ -866,6 +866,26 @@ function hom(G::FinGenAbGroup, H::FinGenAbGroup, A::Matrix{ <: Map{FinGenAbGroup
return h
end

"""
hom_direct_sum(G::FinGenAbGroup, H::FinGenAbGroup, V::Vector{<:Map{FinGenAbGroup, FinGenAbGroup}})
For groups `G = prod G_i` and `H = prod H_i` as well as maps `V_i: G_i -> H_i`,
build the induced map from `G -> H`.
"""
function hom_direct_sum(G::FinGenAbGroup, H::FinGenAbGroup, V::Vector{<:Map{FinGenAbGroup, FinGenAbGroup}})
dG = get_attribute(G, :direct_product)
dH = get_attribute(H, :direct_product)

if dG === nothing || dH === nothing
error("both groups need to be direct products")
end
@assert length(V) == length(dG) == length(dH)

@assert all(i -> domain(V[i]) == dG[i] && codomain(V[i]) == dH[i], 1:length(V))
h = hom(G, H, cat([matrix(V[i]) for i=1:length(V)]..., dims=(1,2)), check = !true)
return h
end

function _flat(G::FinGenAbGroup)
s = get_attribute(G, :direct_product)
if s === nothing
Expand Down Expand Up @@ -981,13 +1001,13 @@ end
(G::FinGenAbGroup...) = tensor_product(G..., task = :none)

@doc raw"""
hom(G::FinGenAbGroup, H::FinGenAbGroup, A::Vector{ <: Map{FinGenAbGroup, FinGenAbGroup}}) -> Map
hom_tensor(G::FinGenAbGroup, H::FinGenAbGroup, A::Vector{ <: Map{FinGenAbGroup, FinGenAbGroup}}) -> Map
Given groups $G = G_1 \otimes \cdots \otimes G_n$ and
$H = H_1 \otimes \cdot \otimes H_n$ as well as maps
$\phi_i: G_i\to H_i$, compute the tensor product of the maps.
"""
function hom(G::FinGenAbGroup, H::FinGenAbGroup, A::Vector{ <: Map{FinGenAbGroup, FinGenAbGroup}})
function hom_tensor(G::FinGenAbGroup, H::FinGenAbGroup, A::Vector{ <: Map{FinGenAbGroup, FinGenAbGroup}})
tG = get_attribute(G, :tensor_product)
tG === nothing && error("both groups must be tensor products")
tH = get_attribute(H, :tensor_product)
Expand Down
2 changes: 2 additions & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ export hnf
export hnf!
export hnf_extend!
export hom
export hom_direct_sum
export hom_tensor
export homogeneous_equation
export howell_form
export hyperbolic_plane_lattice
Expand Down
4 changes: 2 additions & 2 deletions test/GrpAb/GrpAbFinGen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,8 @@
T, p = tensor_product(G, G)
D = direct_product(G, G, task = :none)
for i=1:5
Th = hom(T, T, map(mH, [rand(H) for x = 1:2])) #induced map in tensor product
Dh = hom(D, D, map(mH, rand(H, (2,2)))) #induced map on direct prod
Th = hom_tensor(T, T, map(mH, [rand(H) for x = 1:2])) #induced map in tensor product
Dh = hom_direct_sum(D, D, map(mH, rand(H, (2,2)))) #induced map on direct prod
end
#=
Expand Down

2 comments on commit c9da9fa

@thofma
Copy link
Owner

@thofma thofma commented on c9da9fa May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/106154

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.31.3 -m "<description of version>" c9da9fa99b3a241fdd501defd136de5cb8e1f20c
git push origin v0.31.3

Please sign in to comment.