test
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(const std::vector<UInt_t>& permutation1,
32  const std::vector<UInt_t>& permutation2);
33  Int_t EqualPermutation_2_0(const std::vector<UInt_t>& permutation1,
34  const std::vector<UInt_t>& permutation2);
35  Int_t EqualPermutation_2_2(const std::vector<UInt_t>& permutation1,
36  const std::vector<UInt_t>& permutation2);
37  Int_t EqualPermutation_N_1(const std::vector<UInt_t>& permutation1,
38  const std::vector<UInt_t>& permutation2);
39 
40  void Print(const std::vector<UInt_t>& permutation);
41  void Print(const 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(const std::vector <std::vector <UInt_t> >& permutation1,
53  std::vector <std::vector <UInt_t> > &permutation2);
54  void Skip_2_2(const std::vector <std::vector <UInt_t> >& permutation1,
55  std::vector <std::vector <UInt_t> > &permutation2);
56 
57  std::vector<UInt_t> Rotate(const 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_N_1(const std::vector< UInt_t > &permutation1, const std::vector< UInt_t > &permutation2)
std::vector< std::vector< UInt_t > > GetCombinations()
Int_t EqualPermutation_2_2(const std::vector< UInt_t > &permutation1, const std::vector< UInt_t > &permutation2)
std::vector< std::vector< UInt_t > > m_Permutations
Definition: Combinatorics.h:63
std::vector< std::vector< UInt_t > > GetCombinations_N_1()
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()
Int_t EqualPermutation_2_0(const std::vector< UInt_t > &permutation1, const std::vector< UInt_t > &permutation2)
virtual ~Combinatorics()
std::vector< std::vector< UInt_t > > m_Combinations
Definition: Combinatorics.h:64
Bool_t next_permutation(int size, int *permutation)
void Skip_2_0(const std::vector< std::vector< UInt_t > > &permutation1, std::vector< std::vector< UInt_t > > &permutation2)
std::vector< std::vector< UInt_t > > GetPermutations()
std::vector< std::vector< UInt_t > > GetCombinations_2_2()
void Print(const std::vector< UInt_t > &permutation)
Int_t EqualPermutation(const std::vector< UInt_t > &permutation1, const std::vector< UInt_t > &permutation2)
void initial_permutation(int size, int *permutation)
void initial_subset(int k, int *subset)
tuple size
Write out results.
std::vector< UInt_t > Rotate(const std::vector< UInt_t > &permutation, UInt_t digits)
void Skip_2_2(const std::vector< std::vector< UInt_t > > &permutation1, std::vector< std::vector< UInt_t > > &permutation2)