Package young :: Module combination
[show private | hide private]
[frames | no frames]

Module young.combination

library for permutation and combination
Function Summary
  catalan(num)
catalan(n) -> Return the Catalan number
  catalan_generator()
catalan_generator() -> Return the Catalan number as a generator.
  combination(first, second)
combination(n, m) -> Return the combination of (n,m).
  factorial(x, y)
factorial([m=1), n) -> Return the factorial of n.
  k_composition(n, k)
k_composition(n, k) -> Return the number of k-composition of n.
  permutation(*seq)
permutation(sequence) -> Return the permutation of sequence
  weak_k_composition(n, k)
weak_k_composition(n, k) -> Return the number of weak k-composition of n.
  _combination_of_integer(big, small)
combination of two integers.
  _combination_of_sequence(seq, num)
out of the sequence, take num elements
  _mul_of_iterable(iterable, initial_value)
Return the multiply of iterable.
  com_gen(seq, k)
Generate all combinations of k elements from the seq.
  half_perm_gen(seq)
generate half of all permutations from a given sequence.
  perm_gen(seq)
generate all permutations from a given sequence.
  permhalf(seq)

Function Details

catalan(num)

catalan(n) -> Return the Catalan number

catalan_generator()

catalan_generator() -> Return the Catalan number as a generator.

combination(first, second)

combination(n, m) -> Return the combination of (n,m).

n can be a sequence or an integer. m must be an integer.

If n is an integer, return the combination of (n, m)

If n is a sequence, out of the sequence, take m elements.

factorial(x, y=0)

factorial([m=1), n) -> Return the factorial of n.

If m is given, multiply an iterable from m to n. i.e., m x (m+1) x ... x n

k_composition(n, k)

k_composition(n, k) -> Return the number of k-composition of n.

permutation(*seq)

permutation(sequence) -> Return the permutation of sequence

weak_k_composition(n, k)

weak_k_composition(n, k) -> Return the number of weak k-composition of n.

_combination_of_integer(big, small)

combination of two integers.

_combination_of_sequence(seq, num)

out of the sequence, take num elements

_mul_of_iterable(iterable, initial_value=0)

Return the multiply of iterable.

com_gen(seq, k)

Generate all combinations of k elements from the seq.

half_perm_gen(seq)

generate half of all permutations from a given sequence.

perm_gen(seq)

generate all permutations from a given sequence.

Generated by Epydoc 2.1 on Wed Dec 08 22:20:20 2004 http://epydoc.sf.net