PolyBoRi
PairStatusSet.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
14 //*****************************************************************************
15 
16 #ifndef polybori_groebner_PairStatusSet_h_
17 #define polybori_groebner_PairStatusSet_h_
18 
19 // include basic definitions
20 #include "groebner_defs.h"
21 
22 #include <boost/dynamic_bitset.hpp>
23 
25 
31 public:
32  typedef boost::dynamic_bitset<> bitvector_type;
33  bool hasTRep(int ia, int ja) const {
34  int i,j;
35  i=std::min(ia,ja);
36  j=std::max(ia,ja);
37  return table[j][i]==HAS_T_REP;
38  }
39  void setToHasTRep(int ia, int ja){
40  int i,j;
41  i=std::min(ia,ja);
42  j=std::max(ia,ja);
43  table[j][i]=HAS_T_REP;
44  }
45 
46  template <class Iterator>
47  void setToHasTRep(Iterator start, Iterator finish, int ja){
48  for (; start != finish; ++start)
49  setToHasTRep(*start, ja);
50  }
51  void setToUncalculated(int ia, int ja){
52  int i,j;
53  i=std::min(ia,ja);
54  j=std::max(ia,ja);
55  table[j][i]=UNCALCULATED;
56  }
57 
58  template <class Iterator>
59  void setToUncalculated(Iterator start, Iterator finish, int ja){
60  for (; start != finish; ++start)
61  setToUncalculated(*start, ja);
62  }
63 
64  int prolong(bool value=UNCALCULATED){
65  int s=table.size();
66  table.push_back(bitvector_type(s, value));
67  return s;
68  }
69  PairStatusSet(int size=0){
70  int s=0;
71  for(s=0;s<size;s++){
72  prolong();
73  }
74  }
75  static const bool HAS_T_REP=true;
76  static const bool UNCALCULATED=false;
77 
78 protected:
79 std::vector<bitvector_type> table;
80 };
81 
83 
84 #endif /* polybori_PairStatusSet_h_ */