-
Notifications
You must be signed in to change notification settings - Fork 162
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
Show a warning when GroupWithGenerators called on a domain #3099
Show a warning when GroupWithGenerators called on a domain #3099
Conversation
1677996
to
e941054
Compare
But... why? |
@markuspf what do you mean by "why?"? The commit message explains the reasons, and you may also see the discussion in #3095 and related PRs/issues.
|
Are you sure this mesage is true for all domains? I think could make a domain where taking its generators and making a group from them would produce a different answer (although in such a case the user is doing something very strange...) |
@ChrisJefferson Do you think it should only check for |
Group feels like an easy case to catch -- as previously discussed we could even then just special case groups, but then we are going in a loop :) I don't know enough about how domains are defined to know if there is a good way of catching and warning about exactly the right things. |
e941054
to
4349957
Compare
Codecov Report
@@ Coverage Diff @@
## master #3099 +/- ##
==========================================
- Coverage 83.56% 75.16% -8.4%
==========================================
Files 686 680 -6
Lines 336759 328485 -8274
==========================================
- Hits 281401 246900 -34501
- Misses 55358 81585 +26227
|
Indeed, |
In GAP <= 4.9, the following undocumented use of GroupWithGenerators was possible: gap> GroupWithGenerators( Group( (1,2) ) ); Group([ (), (1,2) ]) This does not work in GAP 4.10.0, and gap-system#3095 restored this never documented behavior to avoid regressions in code that used to work previously. This commit adds a warning when such use of `GroupWithGenerators` is detected.
4349957
to
79a636c
Compare
Info( InfoPerformance, 1, | ||
"Calling `GroupWithGenerators' on a group usually is very inefficient."); | ||
Info( InfoPerformance, 1, | ||
"Use the list of generators of the group instead."); |
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.
But isn't the actual problem that using a large number of generators is usually inefficient? Then, shouldn't the check instead be on the size of gens
? And then, shouldn't it apply equally to lists as to domains or any other kind of collection?
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.
But how then would you know when the number is large? I assume that the number of generators is usually smaller than the number of elements in the group (unless it is already given using a very inefficient list of generators).
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.
Sure, any number we'd pick as "large" would be arbitrary. Just like it is arbitrary to allow Group(AsList(G))
as generators, but not Group(G)
. So my personal preference would be to do neither, i.e., exactly as it is right now...
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.
Can't think of any scenario when calling Group(Group(...))
is more efficient than Group(GeneratorsOfGroup(...))
- that's what I am suggesting to catch. Not other inefficiencies, as that would be more ambiguous...
In GAP <= 4.9, the following undocumented use of
GroupWithGenerators
was possible:
This does not work in GAP 4.10.0, and #3095 restored this never documented
behavior to avoid regressions in code that used to work previously.
This PR adds a warning when such use of
GroupWithGenerators
is detected.