-
-
Notifications
You must be signed in to change notification settings - Fork 564
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
Involutions on NSym and QSym part II #15949
Comments
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:5
Hey Darij, I've made some review changes, (minor) optimizations, and rewrote the algorithm for the internal product from bracketing using a backtracing2 algorithm. Please check that it is faster than the old one (I'm guessing you already have some timings...but I will run some later) and you decide if you want to make it the main call for internal product or not. Otherwise if you're happy with my changes, pos_rev. Best, Travis |
comment:6
Thank you! I've looked at all changes apart from the internal product one, for which I'll need some more concentration than I have right now (writing a paper on QSym of all things); I've also added a few more optimizations. Observations:
|
comment:8
BTW sorry for the two merge commits. It looks like both you and I merged our own NSym branches with 6.2.beta5 first and then we had to merge our merges. |
comment:9
NP, I'm happy with your changes and can live with the reversion of the |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:11
For this change diff --git a/src/sage/combinat/ncsf_qsym/ncsf.py b/src/sage/combinat/ncsf_qsym/ncsf.py
index 36eecd9..c7b0849 100644
--- a/src/sage/combinat/ncsf_qsym/ncsf.py
+++ b/src/sage/combinat/ncsf_qsym/ncsf.py
@@ -664,8 +664,9 @@ class NonCommutativeSymmetricFunctions(UniqueRepresentation, Parent):
S = self.realization_of().S()
res = S.zero()
m = len(xs)
+ ys = [xs[i] - i - 1 for i in range(m)]
for s in Permutations(m):
- psco = [xs[i] + s[i] - i - 1 for i in range(m)]
+ psco = [ys[i] + s[i] for i in range(m)]
if not all(j >= 0 for j in psco):
continue
psco2 = [j for j in psco if j != 0] its (slightly) faster to use
and
|
comment:12
Thanks -- I have somewhat mixed feelings about enumerate when lists can be small, but here it speeds things up (a bit). I'll fix this in my next commit. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:14
Remove the 'also' in that reference you changed and then its pos_rev from me. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:16
OK, so I don't have the time to prove this algorithm, but I see how it works and why it should work. Nice idea! I am not replacing the standard internal coproduct method since I don't know the complexities of the two algorithms involved, but it's certainly useful in its existing form already. I assume you're fine with my current changes? New commits:
|
comment:17
My implementation is light-years faster (even accounting for bias in my test) than the one via coercion. Try it on compositions of 8 (I got bored and stopped it):
So I'm in favor of making the standard algorithm. Would you be good with this? Your current changes are good. |
comment:18
The case I'm worried about is when I is rather long ([1,1,5] doesn't do that trick) and n is in the range not easily tested (between 8 and 12, or so); I'm not sure how well this extends to this case. Here is an example where the bracketing algorithm is considerably slower than the standard one (because the standard one converts to the Complete basis, which is simple for Psi's of spread-out compositions):
Some hybrid might be good, but I'd rather not make it the default. And I'd rather not do it in this patch :/ Thanks a lot for the optimized algorithm, nevertheless -- I'm positive I'll have a use for it even without having computed its running time. Would you agree with positive_review? |
Reviewer: Travis Scrimshaw |
comment:19
I get 2m 45s versus 8s:
Perhaps there was some caching going on that resulted in the speedup? Most of the time spent seems to be in computing the list of integer matrices (which definitely could use optimization). So I'm okay with a positive review here since the bottleneck is not in this code and it should be faster for "long" compositions. PS - this one seems to be the worst:
|
comment:20
OOPS, I've mucked up the size of the compositions in the test. Thanks for the positive_review! |
Changed branch from public/combinat/invol-nsym-2 to |
This continues #15476. It is not my last word on NSym (I'm still planning to implement Eulerian and other idempotents -- but this is waiting on the merge of #15650 and not much of a priority anyway).
The following has been implemented:
the omega involution on NSym and QSym (and alternative syntaxes for that on Sym);
fixes on some NSym and QSym methods to return values in correct parents;
Verschiebung on the elementary basis of NSym (it would formerly use coercion for that, but there's a simple formula);
a way to compute the internal product on the Psi basis of NSym (which is very fast if the compositions have small length, but otherwise is quite wasteful -- hence not made a default);
immaculate functions in NSym indexed by arbitrary integer vectors (not just compositions);
the reduced Kronecker product (formerly in Reduced Kronecker product of symmetric functions #15825, now moved here and fixed);
an analogue thereof (but not a lift) on NSym;
the t-completion of a partition (formerly in Reduced Kronecker product of symmetric functions #15825);
improvements on the to_dyck_word method on partitions (formerly in Reduced Kronecker product of symmetric functions #15825).
CC: @zabrocki @tscrim @sagetrac-sage-combinat
Component: combinatorics
Keywords: partitions, symmetric functions, NSym, QSym, NCSF, Kronecker product
Author: Darij Grinberg
Branch/Commit:
5951b6d
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/15949
The text was updated successfully, but these errors were encountered: