Opened 9 years ago
Closed 8 years ago
#15282 closed defect (duplicate)
Labelling of product posets seem to normalize the labels of the posets
Reported by: | Darij Grinberg | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | categories | Keywords: | posets, finite_posets, sage-combinat |
Cc: | Sage Combinat CC user, Anne Schilling, Travis Scrimshaw, Jori Mäntysalo, Nathann Cohen | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
When taking the product of two posets, apparently both posets are getting relabelled:
sage: A = Posets.ChainPoset(3) sage: B = A.product(A).product(A) sage: sage: B[0] # one would expect (0, 0, 0) (0, 0) sage: B[1] # but no (0, 1) sage: B[2] # instead, the first coordinate is what really should be (0, 2) sage: B[3] # 3 * the first coordinate + the second coordinate (1, 0) sage: B[4] # while the second coordinate is OK (1, 1) sage: B[5] # but only because the second factor was already (1, 2) sage: B[6] # labelled with 0, 1, 2 (2, 0) sage: B[7] (2, 1) sage: B[8] (2, 2) sage: B[9] (3, 0) sage: B[10] (6, 0) sage: B.show()
This doesn't exactly help coding.
Change History (13)
comment:1 Changed 9 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 9 years ago by
Description: | modified (diff) |
---|
comment:3 Changed 9 years ago by
comment:5 Changed 9 years ago by
Milestone: | sage-6.1 → sage-6.2 |
---|
comment:6 Changed 8 years ago by
Milestone: | sage-6.2 → sage-6.3 |
---|
comment:7 Changed 8 years ago by
Milestone: | sage-6.3 → sage-6.4 |
---|
comment:8 Changed 8 years ago by
Cc: | Jori Mäntysalo added |
---|---|
Milestone: | sage-6.4 → sage-duplicate/invalid/wontfix |
Status: | new → needs_review |
I didn't notice this and did #17060 as a new ticket. I suggest this to be closed as a duplicate.
I too think that product
, disjoint_union
and ordinal_sum
might have versions for getting (a,b,c)
instead of ((a,b),c)
. However, it is easy relabeling with lambda l: (l[0][0], l[0][1], l[1])
. Maybe add a note of this to doc of product
? See #17053 and documentation of disjoint_union
.
comment:9 Changed 8 years ago by
Cc: | Nathann Cohen added |
---|
comment:10 follow-up: 11 Changed 8 years ago by
Status: | needs_review → positive_review |
---|
Jori,
When you change the milestone to wontfix, please change the status to positive_review
at the same time.
About the (a,b,c)
instead of ((a,b),c)
thing: it is not that complicated to accept such input if you need it:
sage: def a(*args,**kwds): ....: print args ....: print kwds ....: sage: a(1,2,3,5,labels=True) (1, 2, 3, 5) {'labels': True}
In this case, "args" will be a list of posets that you need to transform into a big poset, and kwds
will be the union of all "named" arguments.
Two things to pay attention to:
1) When building the final poset, it is best to do it all at once and not two by two (faster)
2) Always check that kwds
does not contain something unexpected. Otherwise, this function would say nothing when you call a(1,2,3,labelss="True")
and it is painful to find such typos when you have a bug in your code.
Nathann
comment:11 follow-up: 12 Changed 8 years ago by
Replying to ncohen:
When you change the milestone to wontfix, please change the status to
positive_review
at the same time.
But how to ask if some ticket should be closed or not? I wasn't sure about this one.
comment:12 Changed 8 years ago by
But how to ask if some ticket should be closed or not? I wasn't sure about this one.
Oh. Well, didn't you fix the bug reported here in #17060 ? When you run the example given in this ticket's description with that patch applied, you get the 'expected' thing:
sage: A = Posets.ChainPoset(3) sage: B = A.product(A).product(A) sage: B[0] ((0, 0), 0)
There is only this (0,0,0)
thing to make available if you feel like it.
Nathann
comment:13 Changed 8 years ago by
Resolution: | → duplicate |
---|---|
Status: | positive_review → closed |
I would actually expect things like
((0, 0), 0)
since there is no way to tell if you are taking a 3 fold product from the commands. However I do think there should be an option for keeping the old labels and possibly extend product bywhich would automatically relabel itself with
(0, 0, 0)
since it would "know" it's a 3x product.