SUNphi
1.0
|
Header file for the definition of combinatorial routines. More...
#include <cstdint>
#include <numeric>
#include <containers/Vector.hpp>
#include <debug/Crash.hpp>
#include <ios/Logger.hpp>
Go to the source code of this file.
Classes | |
class | SUNphi::Combinatorial< Int > |
Implements a looper over all combinations of a given kind. More... | |
Functions | |
template<typename Int , typename Fun > | |
Int | SUNphi::loopOnAllCombinations (const Vector< Int > &nMaxPerSlot, const int nObj, const Fun &fun, BACK_FORW BackForw=FORW) |
template<typename I , typename F > | |
I | SUNphi::loopOnAllSubmultiplesOf (const I &i, const F &fun, const BACK_FORW &backForw=FORW) |
template<typename Fun , typename INpart , typename INToPart > | |
auto | SUNphi::loopOnAllAdditivePartitioningOf (const INpart &nOfPart, const INToPart &nToPart, const Fun &fun) |
Header file for the definition of combinatorial routines.
For the time being we limits ourselves to the combinatorial system
Definition in file Combinatorial.hpp.
auto SUNphi::loopOnAllAdditivePartitioningOf | ( | const INpart & | nOfPart, |
const INToPart & | nToPart, | ||
const Fun & | fun | ||
) |
Loop on all additive partitioning of n
Example:
nOfPart | Number of partitions |
nToPart | Number to partition |
fun | Function invocated |
Definition at line 451 of file Combinatorial.hpp.
Int SUNphi::loopOnAllCombinations | ( | const Vector< Int > & | nMaxPerSlot, |
const int | nObj, | ||
const Fun & | fun, | ||
BACK_FORW | BackForw = FORW |
||
) |
Loop on all combinations
Run the provided function, passing the combo at each iteration, and returning the total number of combinations. If BackForw is true, loop forward, otherwise loop backward
Count
Combination generator
nMaxPerSlot | Maximal number of objects per slot |
nObj | Number of objects |
fun | Function to be called |
BackForw | Loop direction |
Definition at line 329 of file Combinatorial.hpp.
I SUNphi::loopOnAllSubmultiplesOf | ( | const I & | i, |
const F & | fun, | ||
const BACK_FORW & | backForw = FORW |
||
) |
Loop on all submultiple of the passed number
Run the provided function, passing the submultiple at each iteration, and returning the total number of submultiple
List all factors
Independent factors and maximal number they can be taken
Independent factors
Maximal number of times a factor can be taken
Number of factors
Number of independent factors
Number of submultiples
Multiple
i | Number on which to run the loop |
fun | Function to run at each iteration |
backForw | Loop direction |
Definition at line 370 of file Combinatorial.hpp.