Functions to generate combinations of integers. More...
#include <vcl_cassert.h>#include <vcl_vector.h>#include <vcl_iostream.h>#include <vcl_algorithm.h>Go to the source code of this file.
Functions | |
| vcl_vector< unsigned > | mbl_combination_begin (const vcl_vector< unsigned > &n) |
| Generate first combination (n.size() zeros). | |
| bool | mbl_combination_next (vcl_vector< unsigned > &x, const vcl_vector< unsigned > &n) |
| Moves x to next combination of integers. | |
| unsigned | mbl_n_combinations (const vcl_vector< unsigned > &n) |
| Number of possible combinations of n.size() values, drawing one from each of n[i] elements. | |
| void | mbl_print_combination (vcl_ostream &os, const vcl_vector< unsigned > &x) |
| Print combination as x3:x2:x1:x0. | |
Functions to generate combinations of integers.
Definition in file mbl_combination.h.
| vcl_vector<unsigned> mbl_combination_begin | ( | const vcl_vector< unsigned > & | n | ) | [inline] |
Generate first combination (n.size() zeros).
Definition at line 15 of file mbl_combination.h.
| bool mbl_combination_next | ( | vcl_vector< unsigned > & | x, |
| const vcl_vector< unsigned > & | n | ||
| ) | [inline] |
Moves x to next combination of integers.
x[i] is a positive integer base n[i]
This allows stepping through all possible combinations of sets integers {x[i]} using
vcl_vector<unsigned> x = mbl_combination_begin(n); do { ...} while (mbl_combination_next(x,n));
Definition at line 32 of file mbl_combination.h.
| unsigned mbl_n_combinations | ( | const vcl_vector< unsigned > & | n | ) | [inline] |
Number of possible combinations of n.size() values, drawing one from each of n[i] elements.
Definition at line 45 of file mbl_combination.h.
| void mbl_print_combination | ( | vcl_ostream & | os, |
| const vcl_vector< unsigned > & | x | ||
| ) | [inline] |
Print combination as x3:x2:x1:x0.
Definition at line 54 of file mbl_combination.h.
1.7.5.1