Ticket #5200 (closed enhancement: fixed)
[with patch, positive review] subsets and subwords bug fix + improvements.
| Reported by: | hivert | Owned by: | hivert |
|---|---|---|---|
| Priority: | major | Milestone: | sage-3.4.1 |
| Component: | combinatorics | Keywords: | subsets, subwords |
| Cc: | sage-combinat | Author(s): | |
| Report Upstream: | Reviewer(s): | ||
| Merged in: | Work issues: |
Description (last modified by hivert) (diff)
This patches improves subwords and subsets and deals with several issues:
- It implements subsets for finite multisets (sets with repetitions).
sage: Subsets([2,2,3], multiset=True).list() [[], [2], [3], [2, 2], [2, 3], [2, 2, 3]]
- It implement __contains__ which was missing for subsets and subwords:
Before:
sage: st = Subsets([1,2,2,3]); Set([1,2]) in st --------------------------------------------------------------------------- NotImplementedError Traceback (most recent call last)
After:sage: st = Subsets([1,2,2,3]); Set([1,2]) in st True
- It fixes a bug in smallest_positions:
Before:
sage: sage.combinat.subword.smallest_positions([2,4,3,3,1,2],[1,3,3]) [4, 4, 4]
After:sage.combinat.subword.smallest_positions([2,4,3,3,1,2],[1,3,3]) False
which means that 113 is not a subword of 243312. - It finally improves the doc and the tests.
Cheers,
Florent
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

