Skip to content

subsets and subwords bug fix + improvements. #5200

@hivert

Description

@hivert

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.  
  1. 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions