/usr/include/polybori/groebner/PairManager.h is in libbrial-groebner-dev 0.8.5-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | // -*- c++ -*-
//*****************************************************************************
/** @file PairManager.h
*
* @author Michael Brickenstein
* @date 2011-06-29
*
* This file includes the definition of the class @c PairManager.
*
* @par Copyright:
* (c) 2006-2010 by The PolyBoRi Team
*
**/
//*****************************************************************************
#ifndef polybori_groebner_PairManager_h_
#define polybori_groebner_PairManager_h_
#include "PairStatusSet.h"
// include basic definitions
#include "groebner_defs.h"
#include "pairs.h"
#include "PolyEntry.h"
#include "NextSpoly.h"
#include "CheckChainCriterion.h"
#include <polybori/routines/pbori_algo.h>
#include <utility>
BEGIN_NAMESPACE_PBORIGB
/** @class PairManager
* @brief This class defines PairManager.
*
**/
class PairManager {
typedef PairManager self;
public:
typedef std::priority_queue<Pair, std::vector<PairE>, PairECompare>
queue_type;
PairManager(const BoolePolyRing& ring):
queue(ring) { }
void appendHiddenGenerators(std::vector<Polynomial>& vec) {
queue_type temp(queue);
while(!temp.empty()){
appendTo(vec, temp.top());
temp.pop();
}
}
void introducePair(const Pair& pair, bool isHFE) {
if (!skip(pair, isHFE)) queue.push(pair);
};
Polynomial nextSpoly(ReductionStrategy& gen) {
if (PBORI_UNLIKELY(pairSetEmpty()))
return gen.leadingTerms.ring().zero();
return NextSpoly(gen, status)(popped());
}
bool pairSetEmpty() const { return queue.empty(); }
template <class StrategyType>
void cleanTopByChainCriterion(StrategyType& strat) {
CheckChainCriterion<StrategyType> continuing(strat, status);
while(!pairSetEmpty() && continuing(queue.top()))
queue.pop();
}
PairStatusSet status;
queue_type queue;
protected:
/// @c top() and @c pop() at once
Pair popped() {
Pair result = queue.top();
queue.pop();
return result;
}
private:
bool skip(const Pair& pair, bool isHFE) {
return isHFE && (pair.getType() == IJ_PAIR) && (pair.sugar > 4);
};
/// Append delayed pairs only
void appendTo(std::vector<Polynomial>& vec, const Pair& current) const {
if (current.getType() == DELAYED_PAIR)
appendTo(vec, current.delayedPair().p);
}
/// Append nonzero polynomials only
void appendTo(std::vector<Polynomial>& vec, const Polynomial& poly) const {
if (!poly.isZero())
vec.push_back(poly);
}
};
END_NAMESPACE_PBORIGB
#endif /* polybori_groebner_PairManager_h_ */
|