PolyBoRi
RankingVector.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 //*****************************************************************************
14 //*****************************************************************************
15 
16 #ifndef polybori_groebner_RankingVector_h_
17 #define polybori_groebner_RankingVector_h_
18 
19 // include basic definitions
20 #include "groebner_defs.h"
21 
22 #include <vector>
23 
25 
31  public std::vector<int> {
32  typedef std::vector<value_type> base;
33 
34 public:
35  RankingVector(size_type len): base(len, 0) {}
36 
37  void increment(size_type idx) { ++operator[](idx); }
38 
39  void rerank(const Exponent& exp) {
40  if (exp.deg() >= 2)
41  for_each(exp.begin(), exp.end(), *this, &RankingVector::increment);
42  }
43 
44  value_type max_index() const {
45  return (empty()? -1: std::max_element(begin(), end()) - begin());
46  }
47 
48 };
49 
50 
52 
53 #endif /* polybori_groebner_RankingVector_h_ */
This class is just a wrapper for using variables for storing indices as interim data structure for Bo...
Definition: BooleExponent.h:34
const_iterator begin() const
Start iteration over indices (constant access)
Definition: BooleExponent.h:97
#define END_NAMESPACE_PBORIGB
Definition: groebner_defs.h:16
value_type max_index() const
Definition: RankingVector.h:44
#define BEGIN_NAMESPACE_PBORIGB
Definition: groebner_defs.h:15
void increment(size_type idx)
Definition: RankingVector.h:37
const_iterator end() const
Finish iteration over indices (constant access)
Definition: BooleExponent.h:100
This class defines RankingVector.
Definition: RankingVector.h:30
void rerank(const Exponent &exp)
Definition: RankingVector.h:39
deg_type deg() const
Degree of the corresponding monomial.
Definition: BooleExponent.h:118
RankingVector(size_type len)
Definition: RankingVector.h:35
void for_each(InIter start, InIter finish, Object &obj, MemberFuncPtr func)
Definition: pbori_algo.h:857