/usr/include/polybori/groebner/ReductionStrategy.h is in libbrial-groebner-dev 1.2.0-2.
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 106 107 108 109 110 111 112 113 114 115 | // -*- c++ -*-
//*****************************************************************************
/** @file ReductionStrategy.h
*
* @author Michael Brickenstein
* @date 2011-06-29
*
* This file includes the definition of the class @c ReductionStrategy.
*
* @par Copyright:
* (c) 2006-2010 by The PolyBoRi Team
*
**/
//*****************************************************************************
#ifndef polybori_groebner_ReductionStrategy_h_
#define polybori_groebner_ReductionStrategy_h_
// include basic definitions
#include "groebner_defs.h"
#include "polynomial_properties.h"
#include "PolyEntryVector.h"
#include "ReductionOptions.h"
#include "ReductionTerms.h"
#include "SetAssociatedMinimal.h"
BEGIN_NAMESPACE_PBORIGB
/** @class ReductionStrategy
* @brief This class defines ReductionStrategy.
*
**/
class ReductionStrategy:
public PolyEntryVector, public ReductionOptions, public ReductionTerms {
typedef ReductionStrategy self;
public:
ReductionStrategy(const BoolePolyRing& ring):
PolyEntryVector(), ReductionOptions(),
ReductionTerms(ring) { }
/// Adding next element
void addGenerator(const PolyEntry& entry) {
PolyEntryVector::append(entry);
setupSetsForElement(back());
}
/// Adding next generator
/// @note overwriting virtual to avoid inconsistency when casting
void append(const PolyEntry& entry) { addGenerator(entry); }
Polynomial nf(const Polynomial& p) const {
return (optRedTail? reducedNormalForm(p): headNormalForm(p));
}
bool canRewrite(const Polynomial& p) const {
return is_rewriteable(p, minimalLeadingTerms);
}
int select1(const Polynomial& p) const;
int select1(const Monomial& m) const;
int select_short(const Polynomial& p) const {
return select_short_by_terms(p.leadDivisors());
}
int select_short(const Monomial& m) const {
return select_short_by_terms(m.divisors());
}
Polynomial headNormalForm(const Polynomial& p) const;
Polynomial reducedNormalForm(const Polynomial& p) const;
void llReduceAll();
protected:
void llReduce(const PolyEntry& entry, const Exponent& ll_e);
int select_short_by_terms(const MonomialSet&) const;
void unmarkNonMinimalLeadingTerms(MonomialSet removed) {
std::for_each(removed.expBegin(), removed.expEnd(),
SetAssociatedMinimal<Exponent, false>(*this));
}
void setupSetsForElement(const PolyEntry& entry);
template <class Iterator, class CompareType>
size_type minimum(Iterator start, Iterator finish, const CompareType& comp)
const {
start = std::min_element(start, finish, comp);
if PBORI_UNLIKELY(start == finish)
return size_type(-1);
return index(*start);
}
};
inline bool
irreducible_lead(Monomial lm, const ReductionStrategy& strat){
return (!(strat.minimalLeadingTerms.hasTermOfVariables(lm)));//
// strat.generators.minimalLeadingTerms.intersect(lm.divisors()).isZero();
}
END_NAMESPACE_PBORIGB
#endif /* polybori_ReductionStrategy_h_ */
|