CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Combinatorics.h
Go to the documentation of this file.
1 /*
2  * Combinatorics.h
3  *
4  * 03/04/2006 kasselmann@physik.rwth-aachen.de
5  *
6  */
7 
8 #ifndef COMBINATORICS_H
9 #define COMBINATORICS_H
10 
11 // C++ header
12 #include <vector>
13 
14 // ROOT header
15 #include <TROOT.h>
16 
18 {
19 
20 public:
21 
22  Combinatorics(Int_t Set, Int_t Subset);
23  virtual ~Combinatorics();
24 
25  std::vector < std::vector <UInt_t> > GetPermutations();
26  std::vector < std::vector <UInt_t> > GetCombinations();
27  std::vector < std::vector <UInt_t> > GetCombinations_2_0();
28  std::vector < std::vector <UInt_t> > GetCombinations_2_2();
29  std::vector < std::vector <UInt_t> > GetCombinations_N_1();
30 
31  Int_t EqualPermutation(std::vector<UInt_t> permutation1,
32  std::vector<UInt_t> permutation2);
33  Int_t EqualPermutation_2_0(std::vector<UInt_t> permutation1,
34  std::vector<UInt_t> permutation2);
35  Int_t EqualPermutation_2_2(std::vector<UInt_t> permutation1,
36  std::vector<UInt_t> permutation2);
37  Int_t EqualPermutation_N_1(std::vector<UInt_t> permutation1,
38  std::vector<UInt_t> permutation2);
39 
40  void Print(std::vector<UInt_t> permutation);
41  void Print(std::vector <std::vector <UInt_t> > permutations);
42 
43 private:
44 
45  Int_t CalculatePermutations();
46 
47  void initial_permutation(int size, int *permutation);
48  Bool_t next_permutation(int size, int *permutation);
49  void initial_subset(int k, int *subset);
50  Bool_t next_subset(int n, int k, int *subset);
51 
52  void Skip_2_0(std::vector <std::vector <UInt_t> > permutation1,
53  std::vector <std::vector <UInt_t> > &permutation2);
54  void Skip_2_2(std::vector <std::vector <UInt_t> > permutation1,
55  std::vector <std::vector <UInt_t> > &permutation2);
56 
57  std::vector<UInt_t> Rotate(std::vector <UInt_t> permutation, UInt_t digits);
58 
59  const Int_t m_SetQuantity;
60  const Int_t m_SubsetQuantity;
61 
62  std::vector<UInt_t> m_Subset;
63  std::vector <std::vector <UInt_t> > m_Permutations;
64  std::vector <std::vector <UInt_t> > m_Combinations;
65 };
66 
67 #endif
Int_t EqualPermutation_2_2(std::vector< UInt_t > permutation1, std::vector< UInt_t > permutation2)
std::vector< std::vector< UInt_t > > GetCombinations()
std::vector< std::vector< UInt_t > > m_Permutations
Definition: Combinatorics.h:63
Int_t EqualPermutation_2_0(std::vector< UInt_t > permutation1, std::vector< UInt_t > permutation2)
Int_t EqualPermutation_N_1(std::vector< UInt_t > permutation1, std::vector< UInt_t > permutation2)
std::vector< std::vector< UInt_t > > GetCombinations_N_1()
std::vector< UInt_t > Rotate(std::vector< UInt_t > permutation, UInt_t digits)
Combinatorics(Int_t Set, Int_t Subset)
Int_t CalculatePermutations()
const Int_t m_SubsetQuantity
Definition: Combinatorics.h:60
std::vector< UInt_t > m_Subset
Definition: Combinatorics.h:62
Bool_t next_subset(int n, int k, int *subset)
const Int_t m_SetQuantity
Definition: Combinatorics.h:59
std::vector< std::vector< UInt_t > > GetCombinations_2_0()
virtual ~Combinatorics()
std::vector< std::vector< UInt_t > > m_Combinations
Definition: Combinatorics.h:64
int k[5][pyjets_maxn]
Bool_t next_permutation(int size, int *permutation)
unsigned int UInt_t
Definition: FUTypes.h:12
std::vector< std::vector< UInt_t > > GetPermutations()
std::vector< std::vector< UInt_t > > GetCombinations_2_2()
void Skip_2_0(std::vector< std::vector< UInt_t > > permutation1, std::vector< std::vector< UInt_t > > &permutation2)
void Skip_2_2(std::vector< std::vector< UInt_t > > permutation1, std::vector< std::vector< UInt_t > > &permutation2)
void initial_permutation(int size, int *permutation)
void initial_subset(int k, int *subset)
Int_t EqualPermutation(std::vector< UInt_t > permutation1, std::vector< UInt_t > permutation2)
void Print(std::vector< UInt_t > permutation)
tuple size
Write out results.