-
-
Notifications
You must be signed in to change notification settings - Fork 655
provide a class for partitions with bounded length and minimal part #38904
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
Documentation preview for this PR (built with commit a20587a; changes) is ready! 🎉 |
@fchapoton, could you please have a look so it doesn't rot away? |
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.
ok. Please avoid doing a lot of cleanup work in this kind of ticket.
Thank you! Sorry, I couldn't resist. |
Dear @fchapoton, I would like to put this back to "needs work", because it doesn't quite solve Max' issue, and it's not hard to do that, but I'd like to avoid deprecation of something I just introduced. Is this OK with you or would you prefer if I open a new pull request? Ideally, I think there should be a single class for partitions of |
and generalize it to handle also max_part
This is now much better. Almost all the time is now spent in I'm open for a better name for the class |
I find it a bit frustrating that we do not need the Failing that, it seems that most of the time is spent in |
The solution was very simple, so I implemented it. Max' problem is still much better solved without using |
@tscrim, there seems to be a problem with sage/src/sage/algebras/quantum_groups/fock_space.py Lines 1734 to 1759 in 39ebbe4
|
Yes, that is not correct. It should be over all partitions of length |
I checked the other containment checks, and many of them fail to treat trailing zeros correctly. So, there is more work to do. I also did a performance check:
where def __contains__(self, x):
...
if x not in _Partitions:
return False
if not self._n:
return not x
return (sum(x) == self._n
and x[-1] >= self._min_part
and x[0] <= self._max_part
and self._min_length <= len(x) <= self._max_length)
def _contains2(self, x):
try:
mu = Partition(x)
except ValueError:
return False
return (mu.size() == self._n
and (not mu
or (min(mu) >= self._min_part
and max(mu) <= self._max_part
and self._min_length <= len(mu) <= self._max_length))) I'm not sure whether it's worth the effort to do something super intelligent here. Note that |
An awful lot of time is spent in line 6464 of the try:
lst = list(map(ZZ, lst))
except TypeError:
raise ValueError(f'all parts of {lst} should be nonnegative integers') Removing Also, |
If tests pass, I hope that this is good enough. |
ping? |
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.
let's move forward and keep further changes for later
sagemathgh-38904: provide a class for partitions with bounded length and minimal part We provide a new class, `PartitionsSmallestGE` to handle subsets of the constraints `length`, `min_length`, `max_length` and `min_part`, to make cardinality computations with such constraints reasonable. Fixes sagemath#38897, sagemath#39107 URL: sagemath#38904 Reported by: Martin Rubey Reviewer(s): Frédéric Chapoton, Martin Rubey, Travis Scrimshaw
sagemathgh-38904: provide a class for partitions with bounded length and minimal part We provide a new class, `PartitionsSmallestGE` to handle subsets of the constraints `length`, `min_length`, `max_length` and `min_part`, to make cardinality computations with such constraints reasonable. Fixes sagemath#38897, sagemath#39107 URL: sagemath#38904 Reported by: Martin Rubey Reviewer(s): Frédéric Chapoton, Martin Rubey, Travis Scrimshaw
sagemathgh-38904: provide a class for partitions with bounded length and minimal part We provide a new class, `PartitionsSmallestGE` to handle subsets of the constraints `length`, `min_length`, `max_length` and `min_part`, to make cardinality computations with such constraints reasonable. Fixes sagemath#38897, sagemath#39107 URL: sagemath#38904 Reported by: Martin Rubey Reviewer(s): Frédéric Chapoton, Martin Rubey, Travis Scrimshaw
sagemathgh-38904: provide a class for partitions with bounded length and minimal part We provide a new class, `PartitionsSmallestGE` to handle subsets of the constraints `length`, `min_length`, `max_length` and `min_part`, to make cardinality computations with such constraints reasonable. Fixes sagemath#38897, sagemath#39107 URL: sagemath#38904 Reported by: Martin Rubey Reviewer(s): Frédéric Chapoton, Martin Rubey, Travis Scrimshaw
We provide a new class,
PartitionsSmallestGE
to handle subsets of the constraintslength
,min_length
,max_length
andmin_part
, to make cardinality computations with such constraints reasonable.Fixes #38897, #39107