-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
Directly convert PermutationGroup element into sized Permutation #37288
Conversation
Does anybody know any better way so that we can avoid try except block here ? |
See my comment. Checking for specific types is usually better than checking for not a specific type when trying to apply methods. |
Oops, learned something myself. I will keep that in mind too :) |
Co-authored-by: Travis Scrimshaw <clfrngrown@aol.com>
Co-authored-by: grhkm21 <83517584+grhkm21@users.noreply.github.com>
I have done all necessary changes that you suggested, thank you for your suggestions ! : ) |
Thank you. However, your test is not good because that was working before from the coercion map defined using |
Is #37318 related? |
From a quick look, doesn’t seem related. |
Then, should I change _coerce_map_from function and redirect the flow to the _from_permutation_group_element whenever G is a PermutationGroup, but I don't know what to include in isinstance function to check wether the group is permutation group or not ? sage/src/sage/combinat/permutation.py Lines 7210 to 7211 in f444d32
|
Co-authored-by: Travis Scrimshaw <clfrngrown@aol.com>
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.
The test is not that good (it is better to not depend on the ordering of the group, and a slightly more general group on, say, 4 letters would be better), but it is sufficient. Hence, we can merge this as-is, but it would be nice to have a slightly better test.
Should I change the test? (Just confirming because @tscrim approved the changes but there is still a 'needs work' label on this PR.) |
@RuchitJagodara I’ve left the decision up to you, but it would be better to have a more generic test. |
I have updated the test, @tscrim can you please review that ? |
That is essentially the same test. The point is to have a more interesting group than something (trivially) isomorphic to the symmetric group. So something like the group generated by |
Sorry, because of my mid-term exams, I was not able to make these changes earlier. But I have changed the test and it is not dependent on ordering of the group, and is not trivial, also. |
When I try to create a permutation group using the generators [(1,2)(2,3), (4,5)], it gives me a ValueError, saying 'invalid data to initialize a permutation.' I am a bit confused as to why that error is occurring. |
Sorry, there was a typo on my part. I meant
Although you could interpret it as
|
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.
Anyways, the test is better now. Thank you. Just a few details left.
Co-authored-by: Travis Scrimshaw <clfrngrown@aol.com>
I have updated the test. Thank you for your suggestions. |
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.
Thank you. LGTM now.
Documentation preview for this PR (built with commit 54747b6; changes) is ready! 🎉 |
This patch fixes #37284 by converting the input into a Permutation class object if
it is the object of another class.
📝 Checklist
⌛ Dependencies