Enumerated set of lists of integers with constraints: front-end#

  • IntegerLists: class which models an enumerated set of lists of integers with certain constraints. This is a Python front-end where all user-accessible functionality should be implemented.

class sage.combinat.integer_lists.lists.IntegerList#

Bases: sage.structure.list_clone.ClonableArray

Element class for IntegerLists.

check()#

Check to make sure this is a valid element in its IntegerLists parent.

EXAMPLES:

sage: C = IntegerListsLex(4)
sage: C([4]).check()
True
sage: C([5]).check()
False
class sage.combinat.integer_lists.lists.IntegerLists(*args, **kwds)#

Bases: sage.structure.parent.Parent

Enumerated set of lists of integers with constraints.

Currently, this is simply an abstract base class which should not be used by itself. See IntegerListsLex for a class which can be used by end users.

IntegerLists is just a Python front-end, acting as a Parent, supporting element classes and so on. The attribute .backend which is an instance of sage.combinat.integer_lists.base.IntegerListsBackend is the Cython back-end which implements all operations such as iteration.

The front-end (i.e. this class) and the back-end are supposed to be orthogonal: there is no imposed correspondence between front-ends and back-ends.

For example, the set of partitions of 5 and the set of weakly decreasing sequences which sum to 5 might be implemented by the same back-end, but they will be presented to the user by a different front-end.

EXAMPLES:

sage: from sage.combinat.integer_lists import IntegerLists
sage: L = IntegerLists(5)
sage: L
Integer lists of sum 5 satisfying certain constraints

sage: IntegerListsLex(2, length=3, name="A given name")
A given name
Element#

alias of IntegerList

backend_class#

alias of sage.combinat.integer_lists.base.IntegerListsBackend