PolyBoRi
|
00001 // -*- c++ -*- 00002 //***************************************************************************** 00014 //***************************************************************************** 00015 00016 #ifndef polybori_groebner_PairStatusSet_h_ 00017 #define polybori_groebner_PairStatusSet_h_ 00018 00019 // include basic definitions 00020 #include "groebner_defs.h" 00021 00022 #include <boost/dynamic_bitset.hpp> 00023 00024 BEGIN_NAMESPACE_PBORIGB 00025 00030 class PairStatusSet{ 00031 public: 00032 typedef boost::dynamic_bitset<> bitvector_type; 00033 bool hasTRep(int ia, int ja) const { 00034 int i,j; 00035 i=std::min(ia,ja); 00036 j=std::max(ia,ja); 00037 return table[j][i]==HAS_T_REP; 00038 } 00039 void setToHasTRep(int ia, int ja){ 00040 int i,j; 00041 i=std::min(ia,ja); 00042 j=std::max(ia,ja); 00043 table[j][i]=HAS_T_REP; 00044 } 00045 00046 template <class Iterator> 00047 void setToHasTRep(Iterator start, Iterator finish, int ja){ 00048 for (; start != finish; ++start) 00049 setToHasTRep(*start, ja); 00050 } 00051 void setToUncalculated(int ia, int ja){ 00052 int i,j; 00053 i=std::min(ia,ja); 00054 j=std::max(ia,ja); 00055 table[j][i]=UNCALCULATED; 00056 } 00057 00058 template <class Iterator> 00059 void setToUncalculated(Iterator start, Iterator finish, int ja){ 00060 for (; start != finish; ++start) 00061 setToUncalculated(*start, ja); 00062 } 00063 00064 int prolong(bool value=UNCALCULATED){ 00065 int s=table.size(); 00066 table.push_back(bitvector_type(s, value)); 00067 return s; 00068 } 00069 PairStatusSet(int size=0){ 00070 int s=0; 00071 for(s=0;s<size;s++){ 00072 prolong(); 00073 } 00074 } 00075 static const bool HAS_T_REP=true; 00076 static const bool UNCALCULATED=false; 00077 00078 protected: 00079 std::vector<bitvector_type> table; 00080 }; 00081 00082 END_NAMESPACE_PBORIGB 00083 00084 #endif /* polybori_PairStatusSet_h_ */