MINT2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
AllPossibleSij Class Reference

#include <AllPossibleSij.h>

Inheritance diagram for AllPossibleSij:

Public Member Functions

 AllPossibleSij (int nDaughters)
 
void print (std::ostream &os=std::cout) const
 

Private Member Functions

bool nextLevel (namedVMap &nextMap)
 

Private Attributes

int _nd
 

Detailed Description

Definition at line 16 of file AllPossibleSij.h.

Constructor & Destructor Documentation

◆ AllPossibleSij()

AllPossibleSij::AllPossibleSij ( int  nDaughters)
inline

Definition at line 21 of file AllPossibleSij.h.

22  : _nd(nDaughters)
23  {
24  std::vector<int> dummy;
25  namedVMap mapA;
26  while(nextLevel(mapA)){
27  this->insert(mapA.begin(), mapA.end());
28  }
29  }
bool nextLevel(namedVMap &nextMap)
std::map< std::string, std::vector< int > > namedVMap

Member Function Documentation

◆ nextLevel()

bool AllPossibleSij::nextLevel ( namedVMap nextMap)
private

Definition at line 7 of file AllPossibleSij.cpp.

7  {
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 }
std::map< std::string, std::vector< int > > namedVMap
std::string anyVectorToString(const std::vector< T > &anyV)
Definition: Utils.h:71

◆ print()

void AllPossibleSij::print ( std::ostream &  os = std::cout) const

Definition at line 36 of file AllPossibleSij.cpp.

36  {
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 }

Member Data Documentation

◆ _nd

int AllPossibleSij::_nd
private

Definition at line 19 of file AllPossibleSij.h.


The documentation for this class was generated from the following files: