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_ */