-
Notifications
You must be signed in to change notification settings - Fork 161
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
Don't use fast method for composing with identity mapping if source & range don't match #2533
Conversation
Needs "Squash and merge" when the time comes. |
Codecov Report
@@ Coverage Diff @@
## master #2533 +/- ##
==========================================
+ Coverage 74.4% 74.4% +<.01%
==========================================
Files 481 481
Lines 243488 243486 -2
==========================================
- Hits 181157 181156 -1
+ Misses 62331 62330 -1
|
Probably also needs a test that works in master. I discovered this with #2521. Adding "Do Not Merge" for now. |
76b5ba0
to
a2dbe3e
Compare
@@ -0,0 +1,13 @@ | |||
# | |||
# There was a bug where composition of an identify mapping and another mapping x where the Source of the identity mapping contained the |
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.
identify -> identity
Also, could you please wrap your lines after 80 or so characters?
# | ||
# There was a bug where composition of an identify mapping and another mapping x where the Source of the identity mapping contained the | ||
# ImagesSource of x, but not its whole range, simply returned x, resulting in a compoition whose Range was strictly bigger than that | ||
# of its first argument, and causign problems in IsomorphismPermGroup |
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.
causign -> causing
@@ -0,0 +1,13 @@ | |||
# | |||
# There was a bug where composition of an identify mapping and another mapping x where the Source of the identity mapping contained the | |||
# ImagesSource of x, but not its whole range, simply returned x, resulting in a compoition whose Range was strictly bigger than that |
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.
compoition -> composition
gap> psi := IdentityMapping(SymmetricGroup(6)); | ||
IdentityMapping( Sym( [ 1 .. 6 ] ) ) | ||
gap> Range(CompositionMapping(psi,phi)); | ||
Sym( [ 1 .. 6 ] ) |
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.
Hmm, phi has Sym(7) as its range (but not as its image!), so on a purely formal level, it shouldn't compose with psi like that, should it?
But OK, GAP doesn't seem to specify what it allows for composition, so I'll assume that only the image is relevant for the legality of the composition, not the range. I guess being stricter about this might be annoying in some situations, while the added "type safety" it provides may not be worth it. (Also, changing existing behavior like that of course is risky)
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.
@fingolfin -- the manual is rather silent on what is allowed for the sources and ranges in a composition, whether there is an implicit restriction, and so on. I'll flag an issue to document and test some set of rules, but I don't want it to get tangled in this, which seems to be a safe bugfix.
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.
Thanks, that's fine by me. So I'll just wait for the typos in the comments above to be fixed.
… range don't match
a2dbe3e
to
470a3ee
Compare
Codecov Report
@@ Coverage Diff @@
## master #2533 +/- ##
==========================================
+ Coverage 74.4% 74.4% +<.01%
==========================================
Files 481 481
Lines 243488 243486 -2
==========================================
Hits 181157 181157
+ Misses 62331 62329 -2
|
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.
So just returning the other map (if one is the identity) is clearly wrong, so the code has to be changed, which is good. There is a chance of a dual problem with the multiplication "the other way round". Also, it would be worth checking what "next method" then gets called, to ensure that this does not lead to performance problems.
@hulpke The dual code (which is just a few lines further up the same file) doesn't have the same problem, which is in and of itself, curious. The "next method" in general, produces an object in |
@stevelinton Thanks for checking. Yes, Images and Ranges are a mess and we might need to keep an eye on this area. |
The code that was there could produce a composition whose range didn't match the second argument, which can never be right.