-
Notifications
You must be signed in to change notification settings - Fork 162
Add hash functions for group elements #5479
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
Open
jamesnohilly
wants to merge
11
commits into
oscar-system:master
Choose a base branch
from
jamesnohilly:jn/hashfunc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+113
−0
Open
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
089fa0a
Add element hash methods
jamesnohilly 9453b71
Add GAP interface for Perm hash
jamesnohilly d25a600
Add hash function for perm
jamesnohilly b13faaa
Allow seed from Julia for hash
jamesnohilly 6a7e228
Remove hash for FPGroupElems
jamesnohilly f781cd3
Add test for hashing permutations
jamesnohilly a80e4f3
Use full_group for PcGroupElems
jamesnohilly 806b407
Fix tests
jamesnohilly f5f74b9
Fix typo
jamesnohilly bbbfc66
Add test for PcGroupElems
jamesnohilly 6968981
Add test for MatrixGroupElem
jamesnohilly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| BindGlobal("HashPermutation", function(p, s) | ||
| local l; | ||
| l:=LARGEST_MOVED_POINT_PERM(p); | ||
|
|
||
| if IsPerm4Rep(p) then | ||
| # is it a proper 4byte perm? | ||
| if l>65536 then | ||
| return HashKeyBag(p,s,GAPInfo.BytesPerVariable,4*l); | ||
| else | ||
| # the permutation does not require 4 bytes. Trim in two | ||
| # byte representation (we need to do this to get consistent | ||
| # hash keys, regardless of representation.) | ||
| TRIM_PERM(p,l); | ||
| fi; | ||
| fi; | ||
|
|
||
| # now we have a Perm2Rep: | ||
| return HashKeyBag(p,s,GAPInfo.BytesPerVariable,2*l); | ||
| end); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -463,3 +463,25 @@ end | |
| z = g([2, 3, 1, 4]) # permutation (1 2 3)(4) | ||
| @test number_of_fixed_points(z) == 1 # only point 4 is fixed | ||
| end | ||
|
|
||
| @testset "hashing permutations" begin | ||
| g = symmetric_group(4) | ||
| a = perm(g, [2, 3, 4, 1]) | ||
| b = perm(g, [2, 3, 4, 1]) | ||
| c = perm(g, [1, 2, 3, 4]) | ||
|
|
||
| @test hash(c) == hash(one(g)) | ||
| @test hash(a) != hash(one(g)) | ||
| @test hash(a) == hash(b) | ||
|
|
||
| h = sylow_subgroup(g, 3)[1] | ||
| a = perm(h, [3, 1, 2]) | ||
| a_bar = @perm (1, 3, 2) | ||
| b = perm(h, [3, 1, 2]) | ||
| c = perm(g, [1, 2, 3]) | ||
|
|
||
| @test hash(c) == hash(one(g)) | ||
| @test hash(a) != hash(one(h)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not a fan of these kinds of tests, as they can non-deterministically fail due to hash collisions |
||
| @test hash(a) == hash(b) # same degree | ||
| @test hash(a) != hash(a_bar) # differing degrees | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we think of groups with large relative orders then
letters(x)can be expected to be a long list.syllables(x)would usually be shorter.Both
lettersandsyllablescreate new objects. Ideally we would take the internally stored exponent vector; for that, a GAP function analogous toHashPermutationwould be needed.