| Trees | Indices | Help |
|
|---|
|
|
A module to provide multiset partition, combination and processor topology decomposition.
Copyright Schrodinger, LLC. All rights reserved.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
__package__ =
|
|||
|
|||
To Do: convert it to a generator. |
@type m: list of integer
@param m: multiset.
@type k: int
@param k: the total number of element that will show up in the combination.
@return the combination in an integer number array.
for i in _multicomb([0, 0, 0, 1, 1, 2, 2, 2, 2, 2], 7):
print i
Above statement will generate below combinations:
[0, 0, 0, 1, 1, 2, 2]
[0, 0, 0, 1, 2, 2, 2]
[0, 0, 0, 2, 2, 2, 2]
[0, 0, 1, 1, 2, 2, 2]
[0, 0, 1, 2, 2, 2, 2]
[0, 0, 2, 2, 2, 2, 2]
[0, 1, 1, 2, 2, 2, 2]
[0, 1, 2, 2, 2, 2, 2]
[1, 1, 2, 2, 2, 2, 2]
@todo: provide a mapping function
|
Return all combinations for multiset m
|
A partition generator
To Do: this algorithm is still not very efficient due to the generation of duplicate combination. A vector partition function with restricted growth order will be a better option. |
A prmie number generator that generates prime number less than or equal to n
|
A function to generate all factorizations of a given integer n.
|
A function to calculate best cpu partition based on dimension and number of processor. The object function to optimize:
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Wed Aug 3 07:59:05 2016 | http://epydoc.sourceforge.net |