Skip to content

feat: add isomorphism method for abelian groups #1724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/GrpAb/GrpAbFinGen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,14 @@ function is_isomorphic(G::FinGenAbGroup, H::FinGenAbGroup)
return elementary_divisors(G) == elementary_divisors(H)
end

function isomorphism(G::FinGenAbGroup, H::FinGenAbGroup)
SG, SGtoG = snf(G)
SH, SHtoH = snf(H)
@req SG.snf == SH.snf "Groups are not isomorphic"
h = hom(SG, SH, gens(SH))
return inv(SGtoG) * h * SHtoH
end

################################################################################
#
# Direct products/direct sums/biproducts
Expand Down
8 changes: 8 additions & 0 deletions test/GrpAb/GrpAbFinGen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,18 @@
@testset "Isomorphism" begin
b = @inferred is_isomorphic(abelian_group(Int[]), abelian_group(Int[]))
@test b
h = isomorphism(abelian_group(Int[]), abelian_group(Int[]))
@test is_bijective(h)

G = abelian_group([2, 3, 5])
H = abelian_group([30])
@test @inferred is_isomorphic(G, H)

h = isomorphism(G, H)
@test is_bijective(h)

K = abelian_group([2, 3])
@test_throws ArgumentError isomorphism(G, K)
end

@testset "Direct product" begin
Expand Down
Loading