File: useBoundInConsideringCall

package info (click to toggle)
frobby 0.9.6-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 11,616 kB
  • sloc: cpp: 30,134; sh: 1,184; makefile: 306; ansic: 102; lisp: 10
file content (34 lines) | stat: -rw-r--r-- 960 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
add to FrobeniusStrategy:

  virtual bool consideringCall(const ExternalTerm& b,
			       bool sameExponentAsNext,
			       const TermTree& tree) {
    unsigned int position = tree.getPosition();

    return
      _bounds[position] + _degreeMultiples[position][b[position]]
      > _maximumDegreeSeen;
  }

  bool canSkipDueToUpperBound(const TermTree& tree, const Degree& degree) {
    unsigned int position = tree.getPosition();

    // Computing the bounds takes more time tham it saves in this
    // case.
    if (position > _dimension - 3)
      return false;

    ExternalTerm lcm(_dimension);
    tree.lcm(lcm);

    Degree upperBound = degree;
    for (unsigned int i = position; i < _dimension; ++i) {
      ASSERT(lcm[i] > 0);
      upperBound += _degreeMultiples[i][lcm[i] - 1];
    }
    _bounds[position] = upperBound - _degreeMultiples[position][lcm[position] - 1];

    return upperBound <= _maximumDegreeSeen;
  }

  vector<Degree> _bounds;