-
-
Notifications
You must be signed in to change notification settings - Fork 660
Closed
Description
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
CC: @sagetrac-sage-combinat
Component: combinatorics
Keywords: subsets, subwords
Issue created by migration from https://trac.sagemath.org/ticket/5200