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

Reorder methods after new implications are added #2773

Merged
merged 2 commits into from
Sep 14, 2018

Conversation

fingolfin
Copy link
Member

@fingolfin fingolfin commented Sep 4, 2018

This is rebased and cleaned up version of #2521; I removed many whitespace-only changes, reformatted a few things and otherwise squashed most changes into a single commit.

Closes #2521
Fixes #2513

@codecov
Copy link

codecov bot commented Sep 4, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@5c02f3c). Click here to learn what that means.
The diff coverage is 94.18%.

@@            Coverage Diff            @@
##             master    #2773   +/-   ##
=========================================
  Coverage          ?   75.92%           
=========================================
  Files             ?      481           
  Lines             ?   241925           
  Branches          ?        0           
=========================================
  Hits              ?   183679           
  Misses            ?    58246           
  Partials          ?        0
Impacted Files Coverage Δ
src/opers.c 94.85% <ø> (ø)
lib/init.g 76.71% <ø> (ø)
lib/error.g 38.2% <0%> (ø)
src/c_type1.c 84.04% <100%> (ø)
src/hpc/c_type1.c 84.47% <100%> (ø)
lib/package.gi 71.02% <28.57%> (ø)
lib/filter.g 92.62% <84.61%> (ø)
lib/oper.g 82.2% <92.47%> (ø)
src/hpc/c_oper1.c 87.14% <98.91%> (ø)
src/c_oper1.c 88.37% <99.14%> (ø)

@fingolfin fingolfin force-pushed the mh/reorder-filters branch 2 times, most recently from fa00be9 to 44a8458 Compare September 12, 2018 12:53
@fingolfin fingolfin added kind: bug Issues describing general bugs, and PRs fixing them kind: bug: wrong result Issues describing bugs that result in mathematically or otherwise wrong results, and PRs fixing them kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Sep 12, 2018
Copy link
Contributor

@ThomasBreuer ThomasBreuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine, except for two very minor comments concerning the documentation

lib/filter.g Outdated Show resolved Hide resolved
lib/oper1.g Outdated Show resolved Hide resolved
Copy link
Contributor

@ThomasBreuer ThomasBreuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more comment about a formulation, sorry that I did not spot this earlier

lib/oper1.g Outdated Show resolved Hide resolved
Many GAP methods get rank adjustments based on the rank of some filter,
e.g, `RankFilter(IsAbelian)`. However, these ranks may change when new
implications are added, e.g. when certain packages are loaded. But those
method rank adjustments then won't be updated, which can ultimately lead
to the effect that loading a package changes which methods get executed
in otherwise identical code.

This PR helps avoid that, by making it possible to set "dynamic" rank
adjustments which get updated as new implications are added. Some cleverness
is needed to make this work efficiently when loading packages.

- Record rank adjustment in METHODS_OPERATION
- Add RECALCULATE_ALL_METHOD_RANKS function which does what it says.
- Adjust MethodsOperation to include base rank
- Increase size of HIDDEN_IMPS_CACHE and WITH_IMPS_CACHE to speed up RECALCULATE_ALL_METHOD_RANKS()
- Make sure RANK_FILTERS is always set promptly, then remove the test for it being unset
  in RankFilter
- Automatically reorder methods after library or package loading, or InstallTrueMethod
- Use COPY_LIST_ENTRIES in method installation to avoid making an intermediate list
- Support passing a function of no arguments as the rank adjustment to InstallMethod
- Reset reordering status on quit from break loop.

Fixes gap-system#2513
... to use a rank *function* instead of a single fixed rank value.
@fingolfin
Copy link
Member Author

No problem, thanks for carefully reading! I removed the comma.

In addition, I added a commit which converts a bunch of InstallMethod calls in the library, which computed some RankFilter values in order to compute a single rank adjustment value, to instead use a rank adjustment function, which (thanks to the first commit) means the rank can be
correctly recomputed as necessary.

A similar thing likely should be done in pacakges...

Now it would be really good if @stevelinton could comment how he'd like to proceed...

@stevelinton
Copy link
Contributor

I'm happy with this. The older PR kept getting test failures which, I think, were actually not caused by the PR but by test infrastructure glitches. Otherwise I'd have merged it.

@stevelinton
Copy link
Contributor

This has passed all tests and been extensively reviewed. Time to merge.

@fingolfin fingolfin merged commit 6a81396 into gap-system:master Sep 14, 2018
@fingolfin fingolfin deleted the mh/reorder-filters branch September 14, 2018 13:11
@fingolfin fingolfin changed the title Reorder methods after new implications are added (rebased PR #2521) Reorder methods after new implications are added Aug 22, 2019
@fingolfin fingolfin added release notes: added PRs introducing changes that have since been mentioned in the release notes and removed release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Aug 22, 2019
@olexandr-konovalov olexandr-konovalov added this to the GAP 4.11.0 milestone Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them kind: bug: wrong result Issues describing bugs that result in mathematically or otherwise wrong results, and PRs fixing them 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Method order does not change when filter ranks change, leading to subtle conflict between nq and lpres
4 participants