| Home | Trees | Indices | Help |
|---|
|
|
Integer vectors
|
|||
| IntegerVectors_all | |||
| IntegerVectors_nk | |||
| IntegerVectors_nkconstraints | |||
| IntegerVectors_nconstraints | |||
|
IntegerVectors_nnondescents The combinatorial class of integer vectors v graded by two parameters: - n: the sum of the parts of v - comp: the non descents composition of v In other words: the length of v equals c[1]+...+c[k], and v is descreasing in the consecutive blocs of length c[1], ..., c[k] Those are the integer vectors of sum n which are lexicographically maximal (for the natural left->right reading) in their orbit by the young subgroup S_{c_1} x \dots x S_{c_k}. |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
infinity = +Infinity
|
|||
|
|||
EXAMPLES:
sage: from sage.combinat.integer_vector import _default_function
sage: import functools
sage: f = functools.partial(_default_function, [1,2,3], 99)
sage: f(0)
99
sage: f(1)
1
sage: f(2)
2
sage: f(3)
3
sage: f(4)
99
|
Given a list l, return a function that takes in a value
i and return l[i-1]. If default is not None, then the function
will return the default value for out of range i's.
EXAMPLES:
sage: f = sage.combinat.integer_vector.list2func([1,2,3])
sage: f(1)
1
sage: f(2)
2
sage: f(3)
3
sage: f(4)
Traceback (most recent call last):
...
IndexError: list index out of range
sage: f = sage.combinat.integer_vector.list2func([1,2,3], 0)
sage: f(3)
3
sage: f(4)
0
|
Returns the constant function i.
EXAMPLES:
sage: f = sage.combinat.integer_vector.constant_func(3)
sage: f(-1)
3
sage: f('asf')
3
|
Returns the combinatorial class of integer vectors.
EXAMPLES:
If n is not specified, it returns the class of all
integer vectors.
sage: IntegerVectors()
Integer vectors
sage: [] in IntegerVectors()
True
sage: [1,2,1] in IntegerVectors()
True
sage: [1, 0, 0] in IntegerVectors()
True
If n is specified, then it returns the class of all
integer vectors which sum to n.
sage: IV3 = IntegerVectors(3); IV3
Integer vectors that sum to 3
Note that trailing zeros are ignored so that [3, 0]
does not show up in the following list (since [3] does)
sage: IntegerVectors(3, max_length=2).list()
[[3], [2, 1], [1, 2], [0, 3]]
If n and k are both specified, then it returns the class
of integer vectors that sum to n and are of length k.
sage: IV53 = IntegerVectors(5,3); IV53
Integer vectors of length 3 that sum to 5
sage: IV53.count()
21
sage: IV53.first()
[5, 0, 0]
sage: IV53.last()
[0, 0, 5]
sage: IV53.random_element()
[4, 0, 1]
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Thu Jul 17 04:23:25 2008 | http://epydoc.sourceforge.net |