MINT2
AllPossibleSij.cpp
Go to the documentation of this file.
1 // author: Jonas Rademacker (Jonas.Rademacker@bristol.ac.uk)
2 // status: Mon 9 Feb 2009 19:17:59 GMT
3 #include "Mint/AllPossibleSij.h"
4 #include "Mint/Utils.h"
5 using namespace MINT; // for stuff in Utils.h
6 
8  namedVMap nextMap;
9  if(thisMap.empty()){
10  for(int i=1; i<= _nd; i++){
11  std::vector<int> v;
12  v.push_back(i);
13  thisMap[anyVectorToString(v)]=v;
14  }
15  }
16 
17  for(namedVMap::iterator it = thisMap.begin();
18  it != thisMap.end(); it++){
19  std::vector<int> v(it->second);
20  int n=v.size();
21  if(n >= _nd -1) return false;
22  int il;
23  if(v.empty()) il=0;
24  else il = v[v.size()-1];
25 
26  v.resize(v.size()+1);
27  for(int i=il+1; i<= _nd; i++){
28  v[n] = i;
29  nextMap[anyVectorToString(v)]=v;
30  }
31  }
32  thisMap = nextMap;
33  return true;
34 }
35 
36 void AllPossibleSij::print(std::ostream& os) const{
37  int counter=0;
38  os << " printing AllPossibleSij for n = " << _nd
39  << ": ";
40  for(namedVMap::const_iterator it = this->begin();
41  it != this->end(); it++, counter++){
42  if(counter > 0) os << ", ";
43  os << it->first;
44  }
45 }
46 
47 
48 //
void print(std::ostream &os=std::cout) const
bool nextLevel(namedVMap &nextMap)
std::map< std::string, std::vector< int > > namedVMap
std::string anyVectorToString(const std::vector< T > &anyV)
Definition: Utils.h:71