-
-
Notifications
You must be signed in to change notification settings - Fork 516
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
fix hash of PermutationGroup_generic #38871
base: develop
Are you sure you want to change the base?
Conversation
Documentation preview for this PR (built with commit b758a92; changes) is ready! 🎉 |
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.
This makes hashing the perm groups very slow as it has to compute the order every time it is being hashed. That can be mostly solved if we cache order()
though, which is probably a good thing to do anyways...
Done, yes that's a good idea, thank you! |
…oups.FiniteGroups.ParentMethods.cardinality
I must say that the handling of
|
I would say it is done that way so you only need to implement one, but other groups can override both for speed (not that they are likely to be called often that though). |
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.
I don't understand why you are removing the alias here.
Also, there are a number of slow doctests being reported with this change. Do you see speed regressions when testing this locally? (It is probably be unavoidable though.)
@@ -2356,7 +2373,7 @@ def order(self): | |||
sage: G.order() | |||
1 | |||
|
|||
:meth:`cardinality` is just an alias:: | |||
:meth:`cardinality` is an alias:: |
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.
This is no longer true with this change. Although I still don't see why you need to change how this is done with defining order
and then making cardinality
an alias. There is no harm in having it IMO.
please rebase |
Currently,
PermutationGroup_generic
inherits its hash method fromCategoryObject
, which uses the string representation of the object. However, string representations of equal permutation groups may be different, which leads to a bug:In current sage, this yields
False
.We base the hash on the cardinality of the group. This is not ideal, because it may take some time to compute it, but I doubt that there is anything cheaper available.
I am hesitant to include the degree, because #36912 is not entirely settled.