Skip to content
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

Merged
merged 1 commit into from
Jun 12, 2018

Conversation

stevelinton
Copy link
Contributor

The code that was there could produce a composition whose range didn't match the second argument, which can never be right.

@stevelinton
Copy link
Contributor Author

Needs "Squash and merge" when the time comes.

@stevelinton stevelinton added kind: bug Issues describing general bugs, and PRs fixing them topic: library labels Jun 8, 2018
@olexandr-konovalov olexandr-konovalov added the gapdays2018-spring Issues and PRs that arose at http://www.gapdays.de/gap-jupyter-days2018 label Jun 8, 2018
@codecov
Copy link

codecov bot commented Jun 8, 2018

Codecov Report

Merging #2533 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            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
Impacted Files Coverage Δ
lib/mapprep.gi 69.37% <100%> (+0.08%) ⬆️
hpcgap/lib/hpc/stdtasks.g 63.93% <0%> (-0.77%) ⬇️
src/iostream.c 63.77% <0%> (+1.13%) ⬆️

@stevelinton stevelinton added the do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) label Jun 10, 2018
@stevelinton
Copy link
Contributor Author

Probably also needs a test that works in master. I discovered this with #2521. Adding "Do Not Merge" for now.

@stevelinton stevelinton force-pushed the mapping-range branch 3 times, most recently from 76b5ba0 to a2dbe3e Compare June 11, 2018 12:17
@stevelinton stevelinton removed the do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) label Jun 11, 2018
@stevelinton stevelinton requested a review from hulpke June 11, 2018 12:18
@@ -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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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 ] )
Copy link
Member

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)

Copy link
Contributor Author

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.

Copy link
Member

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.

@codecov
Copy link

codecov bot commented Jun 11, 2018

Codecov Report

Merging #2533 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2533      +/-   ##
==========================================
+ Coverage    74.4%    74.4%   +<.01%     
==========================================
  Files         481      481              
  Lines      243488   243486       -2     
==========================================
  Hits       181157   181157              
+ Misses      62331    62329       -2
Impacted Files Coverage Δ
lib/mapprep.gi 69.37% <100%> (+0.08%) ⬆️
hpcgap/lib/hpc/stdtasks.g 64.19% <0%> (-0.52%) ⬇️
src/iostream.c 63.77% <0%> (+1.13%) ⬆️

Copy link
Contributor

@hulpke hulpke left a 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.

@stevelinton
Copy link
Contributor Author

@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 IsCompositionMappingRep. One could, I suppose have (in at least one of the two orders) a method that delegates to RestrictedMapping (is there an obvious reason why there isn't a RangeRestrictedMapping which would handle the other case? I don't know if it would make any real difference. We really need to sort out the more general questions in #2540 first.

stevelinton added a commit to stevelinton/gap that referenced this pull request Jun 12, 2018
@hulpke
Copy link
Contributor

hulpke commented Jun 12, 2018

@stevelinton Thanks for checking. Yes, Images and Ranges are a mess and we might need to keep an eye on this area.

@fingolfin fingolfin merged commit fff8dcb into gap-system:master Jun 12, 2018
@fingolfin fingolfin added the release notes: added PRs introducing changes that have since been mentioned in the release notes label Sep 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gapdays2018-spring Issues and PRs that arose at http://www.gapdays.de/gap-jupyter-days2018 kind: bug Issues describing general bugs, and PRs fixing them release notes: added PRs introducing changes that have since been mentioned in the release notes topic: library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants