Closed alauve closed 6 years ago
File in much better shape now (fingers crossed).
Found some bugs in the __contains__
method
Branch pushed to git repo; I updated commit sha1. New commits:
d18f780 | revamped tests for satisfying constraints |
Bugs in __contains__
method zapped.
Branch is red (merge failed).
Branch pushed to git repo; I updated commit sha1. New commits:
659132f | fix merge conflicts in references |
I think I should remove the user shorthand for OrderedMultisetPartition
that uses OrderedMultisetPartitions.from_list()
.
While the shorthand is nice for OrderedMultisetPartition
, I don't see how to make it play nicely with the __getitem__()
method for combinatorial free modules over OrderedMultisetPartitions
.
E.g., in the present state of ticket #25543, these come in correctly:
sage: from sage.combinat.chas.omp_hopf_algebras import HopfAlgebraOnOrderedMultisetPartitions
sage: H = HopfAlgebraOnOrderedMultisetPartitions(QQ).H()
sage: H[[1,2],[1,3]]
H[{1,2}, {1,3}]
sage: H[[[1,2],[1,3]]]
H[{1,2}, {1,3}]
But this one is problematic (there are two possible intended OMPs):
sage: H[[1,2]]
Should it be H(OrderedMultisetPartition([[1,2]]))
or should it be H(OrderedMultisetPartition([1,2]))
NOTE: A similar shorthand confusion happens for WQSym (e.g., tickets #25133, #25151). There, I'd say the problem is even more serious due to the "words" option that we have allowed for that Hopf algebra. Indeed, perhaps this "bug" even merits a new ticket:
sage: M = WordQuasiSymmetricFunctions(QQ).M()
sage: x = M[[1,3],[2]]; x
M[{1, 3}, {2}]
sage: M.options.objects = "words"
sage: x
M[1, 2, 1]
sage: M[OrderedSetPartition([1,2,1])]
M[1, 2, 1]
sage: M[1,2,1]
M[1, 1]
sage: M[[1,2,1]]
M[1, 1]
Branch pushed to git repo; I updated commit sha1. New commits:
4598426 | modified .split(), which was ignoring repeats |
Branch pushed to git repo; I updated commit sha1. New commits:
41f776c | Merge branch 'public/combinat/implement_orbit_basis-25162' of trac.sagemath.org:sage into develop |
5e92f49 | Merge branch 'develop' of trac.sagemath.org:sage into develop |
357bf72 | Merge branch 'develop' into public/combinat/implement-ordered-multiset-partitions-25148 |
Branch pushed to git repo; I updated commit sha1. New commits:
8bc94eb | Merge branch 'develop' into public/combinat/implement-ordered-multiset-partitions-25148 |
a4fbeba | Merge branch 'public/combinat/implement-ordered-multiset-partitions-25148' of trac.sagemath.org:sage into public/combinat/implement-ordered-multiset-partitions-25148 |
df225ca | removed user shorthand for building an omp with the `OrderedMultisetPartition` class |
I removed the functionality
sage: OrderedMultisetPartition([1,2,0,1,2,3])
[{1,2}, {1,2,3}]
because it conflicts with the __getitem__
method when using OrderedMultisetPartitions
as index set for combinatorial free modules.
It still exists as a method for the parent class. That is,
sage: OrderedMultisetPartitions().from_list([1,2,0,1,2,3])
[{1,2}, {1,2,3}]
still works.
Hi Aaron,
Overall, the code looks pretty good. Here are some suggestions from the user point of view:
sage: p=OrderedMultisetPartition([[5, 3], [1, 3, 3]])
...
/Applications/sage/local/lib/python2.7/site-packages/sage/cpython/getattr.pyx in sage.cpython.getattr.getattr_from_other_class (build/cythonized/sage/cpython/getattr.c:2468)()
387 dummy_error_message.cls = type(self)
388 dummy_error_message.name = name
--> 389 raise AttributeError(dummy_error_message)
390 cdef PyObject* attr = instance_getattr(cls, name)
391 if attr is NULL:
AttributeError: 'OrderedMultisetPartitions_X_with_category.element_class' object has no attribute '_n'
sage: P=OrderedMultisetPartitions([0,0,1])
sage: P.from_list([1,0,0,0,0])
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-23-128db23691d7> in <module>()
----> 1 P.from_list([Integer(1),Integer(0),Integer(0),Integer(0),Integer(0)])
/Applications/sage/local/lib/python2.7/site-packages/sage/combinat/multiset_partition_ordered.pyc in from_list(self, lst)
1685 raise ValueError("Something is wrong: `from_list` does not expect to see negative integers; received {}.".format(str(lst)))
1686 if 0 in list(lst) or '0' in list(lst):
-> 1687 return self._from_zero_list(lst)
1688 else:
1689 d = [frozenset([x]) for x in lst]
/Applications/sage/local/lib/python2.7/site-packages/sage/combinat/multiset_partition_ordered.pyc in _from_zero_list(self, lst_with_zeros)
1732 return c
1733 else:
-> 1734 raise ValueError("ordered multiset partitions do not have repeated entries within blocks (%s received)"%str(co))
1735
1736 def an_element(self):
ValueError: ordered multiset partitions do not have repeated entries within blocks ([[1]] received)
deconcatenate
and split
.Branch pushed to git repo; I updated commit sha1. New commits:
ef54c51 | Merge branch 'develop' into public/combinat/implement-ordered-multiset-partitions-25148 |
Branch pushed to git repo; I updated commit sha1. New commits:
f84666b | fixed two references |
One more thing that I noticed is that the picture of the crystal is now not displayed using the ordered multisets (which I think it should!), but rather the tableau model, see
sage: B = crystals.Minimaj(2,3,2)
sage: view(B)
sage: B.list()
[((2, 1), (1,)), ((2,), (1, 2)), ((1,), (1, 2)), ((1, 2), (2,))]
Branch pushed to git repo; I updated commit sha1. New commits:
10c8fd2 | pyflakes mostly |
Branch pushed to git repo; I updated commit sha1. New commits:
04ae9da | correct a doctest |
Branch pushed to git repo; I updated commit sha1. New commits:
0f2e3bf | oops |
Replying to @anneschilling:
One more thing that I noticed is that the picture of the crystal is now not displayed using the ordered multisets (which I think it should!), but rather the tableau model, see
sage: B = crystals.Minimaj(2,3,2) sage: view(B) sage: B.list() [((2, 1), (1,)), ((2,), (1, 2)), ((1,), (1, 2)), ((1, 2), (2,))]
This might take awhile to track down (though I agree with the sentiment), if anybody knows how, precisely, latex decides what to print for an element of a crystal, please chime in.
I tracked down the latex problem. Try again:
age: B = crystals.Minimaj(2,3,2)
sage: view(B)
Branch pushed to git repo; I updated commit sha1. New commits:
f87711a | added a `_latex_` method for elements of minimaj crystal |
Changed keywords from IMA coding sprint, CHAs to IMA coding sprint, CHAs, sage@icerm
Now I get a doctest failure
sage -t multiset_partition_ordered.py
**********************************************************************
File "multiset_partition_ordered.py", line 2229, in sage.combinat.multiset_partition_ordered.OrderedMultisetPartitions_X.__iter__
Failed example:
sorted([next(it) for _ in range(O.cardinality())], key=str)
Expected:
[[{'a'}, {1}, {1}],
[{1,'a'}, {1}],
[{1}, {'a'}, {1}],
[{1}, {1,'a'}],
[{1}, {1}, {'a'}]]
Got:
[[{1,'a'}, {1}],
[{1}, {'a'}, {1}],
[{1}, {1,'a'}],
[{1}, {1}, {'a'}],
[{1}, {1}, {'a'}]]
**********************************************************************
1 item had failures:
1 of 7 in sage.combinat.multiset_partition_ordered.OrderedMultisetPartitions_X.__iter__
[556 tests, 1 failure, 24.87 s]
----------------------------------------------------------------------
sage -t multiset_partition_ordered.py # 1 doctest failed
----------------------------------------------------------------------
Branch pushed to git repo; I updated commit sha1. New commits:
9854729 | fixed doc tests |
Changed keywords from IMA coding sprint, CHAs, sage@icerm to IMA coding sprint, CHAs, sagedays@icerm
That doctest is still fucked up; there is a duplicate in the resulting list(O)
.
Replaced the iterator algorithm by one I was able to prove. That should fix the doctest. Note that I've changed lots of doctests since the new algorithm yields the partitions in a different order; I hope that the old order wasn't being tacitly relied upon!
I figured out what was causing the repeats in iteration, and don't like the recursive algorithm Darij decided on. I'm reverting back to old iteration method (suitably modified). Please have another look.
Branch pushed to git repo; I updated commit sha1. New commits:
4ce9ff9 | modified _iterator_weight to work with standardized multiset partitions |
An ordered multiset partition C of a multiset X is a list of subsets of X (not multisets), called the blocks of C, whose multi-union is X.
These objects appear in the work of
This module provides tools for manipulating ordered multiset partitions.
CC: @tscrim @darijgr @zabrocki @alauve @sagetrac-mshimo @anneschilling @saliola @amypang
Component: combinatorics
Keywords: IMA coding sprint, CHAs, sagedays@icerm
Author: Aaron Lauve, Anne Schilling
Branch:
085a93d
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/25148