#5200: [with patch, needs review] subsets and subwords bug fix + improvements.
---------------------------+------------------------------------------------
Reporter: hivert | Owner: hivert
Type: enhancement | Status: new
Priority: major | Milestone: sage-combinat
Component: combinatorics | Keywords: subsets, subwords
---------------------------+------------------------------------------------
Changes (by hivert):
* owner: mhansen => hivert
Old description:
> This patches deals with several issues concerning subwords and subsets:
> 1. It implements subsets for finite multisets (sets with repetitions).
> Before the patch:
> {{{
> sage: Subsets([2,2,3]).list()
> [{}, {2}, {3}, {2, 3}]
> }}}
> After:
> {{{
> sage: Subsets([2,2,3]).list()
> [[], [2], [3], [2, 2], [2, 3], [2, 2, 3]]
> }}}
> 1. 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
> }}}
> 1. 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.
> 4. It finally improves the doc and the tests.
>
> Since this is my first trac submission, any comment about this text or
> the patch is strongly welcome...
New description:
I've uploaded a new patch according to remark of Nicolas and Mike. It
should be ready for review and hopefully integration.
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5200#comment:3>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---