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
py3: some fix in set_partition #26917
Comments
Commit: |
New commits:
|
Branch: u/chapoton/26917 |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:3
green bot, please review |
comment:4
From the code, this should not be necessary. If this test is failing (on Py3), then is it failing because of a different order or generating an actual failure? If it is the latter, then it is definitely a bug in the code that should be fixed. If the former, then I don't understand why it is failing. |
comment:5
Right. Indeed, it is not failing on python3. It starts to fail (in python2) when we turn the switch in #22029. So, it is more like that: do not mix things that cannot be sorted inside the set underlying a set partition. |
comment:6
I think there should be a decision on the assumption underlying set partitions. There are several possibilities. Currently several methods essentially assume that the ground set is totally ordered. If we stick with this assumption, we can essentially assume that the ground set is 1,...,n. In particular, notions such as crossings and nestings make sense. There was an effort to remove this assumption, introducing |
comment:7
traceback on top of #22029:
|
comment:8
Replying to @mantepse:
I think we should keep the current implementation: Let the methods error out when the TL;DR I think we should avoid forcing the ground set to be |
comment:9
comment:7 is a hard error that prevents a set partition from being constructed from any incomparable objects. My opinion would be to instead do this change: -ClonableArray.__init__(self, parent, sorted(map(frozenset, s), key=min), check=check)
+try:
+ ClonableArray.__init__(self, parent, sorted(map(frozenset, s), key=min), check=check)
+except TypeError:
+ ClonableArray.__init__(self, parent, sorted(map(frozenset, s), key=lambda x: str(min(x))),
+ check=check) |
comment:10
Hi Travis! So, would you (just as I would) vote for removing I admit I am confused about would you would prefer:
I am certainly not saying that we should have only set partitions on |
comment:11
I don't like it, but there are reasons for having it for comb. Hopf algebras IIRC. At least with a partial split, we can be fluid about what goes where, which lowers the maintenance burden. I am for option 1 as people doing things on more generic set partitions will almost certainly not be doing any other special methods (mainly, they are probably looking to enumerate the set partitions). |
comment:12
A related ticket is #25451. However, I think it would indeed be better to get rid of Apart from that I would like to go with Travis' proposal. Any objections? |
comment:14
Replying to @tscrim:
Is the sorting relevant in the first place? Couldn't we just keep things in the order that the user gives them? |
comment:15
No, because we want to be able to compare two set partitions quickly. (the real thing would be to use restricted growth words, but there was a vote against it, and so far nobody asked for really fast set partitions) |
comment:16
Replying to @mantepse:
Yes, I do. This abstraction is useful for the diagram algebras. The number of uses (as long as it is more than one) is not a good reason for removal. It also is not really a big maintenance burden. So -1, still. |
comment:17
I don't mind. What's the second use of Can we go ahead with your proposal in this ticket? |
comment:18
I just realised that I already said that equality of set partitions cannot work
Therefore I think that having an error raised when the base set is not totally ordered is actually much better. (I do realise that the example above won't give an error in python3, but at least we shouldn't make matters worse.) If really desired, generalising set partitions to non-totally ordered sets should go into another ticket, so I'd like to set this to positive review. |
Reviewer: Martin Rubey |
comment:20
Travis, just to be clear: feel free to set this to |
Changed branch from u/chapoton/26917 to u/mantepse/26917 |
comment:22
I took the liberty of adding an example indicating the limitation. New commits:
|
comment:23
This should have been reset to needs review with the extra commit. You should change "is not well defined" to "may give incorrect answers". |
Changed reviewer from Martin Rubey to none |
Changed author from Frédéric Chapoton to Frédéric Chapoton, Martin Rubey |
Reviewer: Frédéric Chapoton |
comment:26
good enough for me. Travis, do you agree ? |
Changed reviewer from Frédéric Chapoton to Frédéric Chapoton, Travis Scrimshaw |
comment:27
This is okay with me. |
comment:28
Retarging tickets optimistically to the next milestone. If you are responsible for this ticket (either its reporter or owner) and don't believe you are likely to complete this ticket before the next release (8.7) please retarget this ticket's milestone to sage-pending or sage-wishlist. |
Changed branch from u/mantepse/26917 to |
CC: @tscrim
Component: python3
Author: Frédéric Chapoton, Martin Rubey
Branch/Commit:
171f988
Reviewer: Frédéric Chapoton, Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/26917
The text was updated successfully, but these errors were encountered: