-
Notifications
You must be signed in to change notification settings - Fork 175
kernel: simplify bits of the transformations and partial perms code #3219
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
Conversation
98d7d32 to
cce81c5
Compare
|
I wanted to extend this a bit more, but while doing so uncovered a bug in |
Codecov Report
@@ Coverage Diff @@
## master #3219 +/- ##
=========================================
Coverage ? 84.84%
=========================================
Files ? 686
Lines ? 330604
Branches ? 0
=========================================
Hits ? 280486
Misses ? 50118
Partials ? 0 |
What do you mean by writing the command |
|
@wilfwilson that command comes from |
|
Here is a simple example that showcases an instance of the bug: |
|
If it's possible to re-request a review once you've done that, then please do, otherwise please write a comment in this thread so that I am alerted :) |
src/trans.cc
Outdated
|
|
||
| Obj QuoTrans2Perm4(Obj f, Obj p) | ||
| static Obj QuoTrans2Perm4(Obj f, Obj p) | ||
| { |
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.
This looks all good to me, can you enlighten me as to why you're adding static here?
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.
My longterm plan is to make all functions static that are not explicitly for external use, so as to avoid the situation were people "accidentally" use them w/o being aware of them being private. See also PR #3204. That doesn't mean they have to stay static/private, but if somebody needs to use a function, we (well, me, at least) would prefer to know about it explicitly. That frees us from the burden of having to verify for every single kernel refactoring whether maybe some package is using that interface anyway (though, luckily, we now again compile and at least test-load almost every distributed package again, including digraphs and semigroups, so this is less of a problem than it used to be).
The other advantage is that it may help the compiler with some optimizations and allows for a slightly slimmer binary (but these are relatively minor points).
BTW, if you have any need to invoke any of these function directly from, say, semigroups (instead of going via e.g. QUO in this case), please tell us, then of course we can leave of the static from those, and/or find some other means to accommodate you; the goal here really isn't to annoy anybody, but rather to prevent future annoyances.
cce81c5 to
27899b3
Compare
|
Rebased now; also replaced even more "quotient of trans or pperm by perm" code |
src/pperm.cc
Outdated
| QuoFuncs[T_PPERM2][T_PERM2] = QuoPPermPerm; | ||
| QuoFuncs[T_PPERM4][T_PERM4] = QuoPPermPerm; | ||
| QuoFuncs[T_PPERM2][T_PERM4] = QuoPPermPerm; | ||
| QuoFuncs[T_PPERM4][T_PERM2] = QuoPPermPerm; |
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.
I just learned that INV for T_PERM2/4 is actually guaranteed to return something in the same rep, so I guess we could optimize this code again by calling ProdPPerm2/4Perm2/4 directly, instead of PROD. But will save just a few cycles to load the function pointer from memory (memory that likely is in the cache anyway), so I am not sure it's worth it? (The extract functions of course then also would in turn require more cache, so I don't dare predict whether it would have positive, negative or no effect at all...)
So unless somebody is really concerned about this, I'd leave it at this single generic function for now...
As a matter of fact, I just noticed that we can even get rid of this completely, in which case QuoDefault will be used, which does the right thing anyway.
27899b3 to
2868366
Compare
Since we are now caching the inverses of permutations, it makes much more sense to simply first invert the permutation using INV(p), then multiply using PROD.
... by using INIT_PPERM and some other helpers that work for both T_PPERM2 and T_PPERM4.
2868366 to
7bdc71a
Compare
No description provided.