#5200: [with patch, needs review] subsets and subwords bug fix + improvements.
---------------------------+------------------------------------------------
Reporter: hivert | Owner: hivert
Type: enhancement | Status: assigned
Priority: major | Milestone: sage-combinat
Component: combinatorics | Keywords: subsets, subwords
---------------------------+------------------------------------------------
Description changed by hivert:
Old description:
> I've uploaded a new patch according to remark of Nicolas and Mike. It
> should be ready for review and hopefully integration.
New description:
This patches improves subwords and subsets and deals with several issues:
1. 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]]
}}}
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.
Cheers,
Florent
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5200#comment:5>
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
-~----------~----~----~----~------~----~------~--~---