CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/CommonTools/Statistics/interface/PartitionGenerator.h

Go to the documentation of this file.
00001 #ifndef _PartitionGenerator_H_
00002 #define _PartitionGenerator_H_
00003 
00004 #include <vector>
00005 
00006 
00013 class PartitionGenerator {
00014 
00015 public:
00016 
00017   typedef std::vector<int> Partition;
00018 
00021   std::vector<Partition> partitions(int collectionSize, 
00022                                int minCollectionSize = 1) const;
00023 
00028   std::vector< std::vector<Partition> > 
00029   sortedPartitions(int collectionSize, int minCollectionSize = 1) const;
00030 
00031 private:
00033   class LessCollections {
00034   public:
00035     bool operator()(const Partition & a, 
00036                     const Partition & b) {
00037       return a.size() < b.size();
00038     }
00039   };
00040 
00041 };
00042 
00043 #endif