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[source]#

Bases: ClonableArray

Element class for IntegerLists.

check()[source]#

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
>>> from sage.all import *
>>> C = IntegerListsLex(Integer(4))
>>> C([Integer(4)]).check()
True
>>> C([Integer(5)]).check()
False
class sage.combinat.integer_lists.lists.IntegerLists(*args, **kwds)[source]#

Bases: 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
>>> from sage.all import *
>>> from sage.combinat.integer_lists import IntegerLists
>>> L = IntegerLists(Integer(5))
>>> L
Integer lists of sum 5 satisfying certain constraints

>>> IntegerListsLex(Integer(2), length=Integer(3), name="A given name")
A given name
Element[source]#

alias of IntegerList

backend = None#
backend_class[source]#

alias of IntegerListsBackend