Skip to content

Commit

Permalink
Merge pull request #36 from kalmarek/mk/edge_cases
Browse files Browse the repository at this point in the history
Fix empty gens
  • Loading branch information
kalmarek authored Nov 29, 2023
2 parents 70e7e37 + 9cd1691 commit 773db9e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PermutationGroups"
uuid = "8bc5a954-2dfc-11e9-10e6-cd969bffa420"
authors = ["Marek Kaluba <kalmar@amu.edu.pl>", "tweisser <tillmann.weisser@web.de>"]
version = "0.4.2"
version = "0.4.3"

[deps]
GroupsCore = "d5909c97-4eac-4ecc-a3dc-fdd0858a4120"
Expand Down
8 changes: 0 additions & 8 deletions src/io.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
function Base.show(io::IO, ::Type{<:PermGroup{I}}) where {I}
return print(io, PermGroup, "{$I, …}")
end
# function Base.show(io::IO, ::Type{<:Permutation{I, G}}) where {I, G}
# return print(io, Permutation, "{$I, …}")
# end
function Base.show(io::IO, G::PermGroup)
print(io, "PermGroup( ")
join(io, gens(G), ", ")
Expand All @@ -25,5 +19,3 @@ function Base.show(io::IO, ::MIME"text/plain", G::PermGroup)
)
return Base.print_array(io, gens(G))
end

# Base.show(io::IO, g::Permutation) = show(io, Perm.perm(g))
2 changes: 2 additions & 0 deletions src/perm_group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and stabilizer chain are computed (and cached) _when needed_.
T::Type{<:AbstractTransversal},
gens::AbstractVector{<:AbstractPermutation},
)
@assert !isempty(gens) "groups need to have at least one generator"
gens_raw = [Perms.perm(s) for s in gens]
return new{eltype(gens_raw),T(eltype(gens_raw))}(gens_raw)
end
Expand All @@ -31,6 +32,7 @@ else
T::Type{<:AbstractTransversal},
gens::AbstractVector{<:AbstractPermutation},
)
@assert !isempty(gens) "groups need to have at least one generator"
gens_raw = [Perms.perm(s) for s in gens]
return new{eltype(gens_raw),T(eltype(gens_raw))}(gens_raw)
end
Expand Down
4 changes: 2 additions & 2 deletions test/perm_groups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
@test order(Int, G) isa Int
@test isdefined(G, :stabchain) == true

@test_throws AssertionError PermGroup()

G = PermGroup(perm"(1,2)", perm"(1,2,3,4)")
@test StabilizerChain(G) isa StabilizerChain
sc = StabilizerChain(G)
Expand Down Expand Up @@ -40,8 +42,6 @@
@test sprint(show, G) == "PermGroup( (1,2), (1,2,3,4) )"
@test sprint(show, MIME"text/plain"(), G) ==
"Permutation group on 2 generators generated by\n (1,2)\n (1,2,3,4)"
@test sprint(show, [G]) ==
"PermGroup{Perm{UInt16}, …}[PermGroup( (1,2), (1,2,3,4) )]"

m = match(r"order (\d+)", sprint(show, MIME"text/plain"(), G))
@test m === nothing
Expand Down

2 comments on commit 773db9e

@kalmarek
Copy link
Owner Author

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/96147

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.4.3 -m "<description of version>" 773db9e9202ebc38976c6410a2125190842187fe
git push origin v0.4.3

Please sign in to comment.