/usr/include/polybori/groebner/fixed_path_divisors.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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | // -*- c++ -*-
//*****************************************************************************
/** @file fixed_path_divisors.h
*
* @author Michael Brickenstein
* @date 2011-07-01
*
* This file includes the definition of the class @c fixed_path_divisors.
*
* @par Copyright:
* (c) 2006-2011 by The PolyBoRi Team
*
**/
//*****************************************************************************
#ifndef polybori_groebner_fixed_path_divisors_h_
#define polybori_groebner_fixed_path_divisors_h_
// include basic definitions
#include "groebner_defs.h"
BEGIN_NAMESPACE_PBORIGB
#ifndef DANGEROUS_FIXED_PATH
typedef PBORI::CacheManager<CCacheTypes::divisorsof_fixedpath>
#else
typedef PBORI::CacheManager<CCacheTypes::divisorsof>
#endif
fixed_divisors_cache_type;
// Variant navigator
inline MonomialSet
do_fixed_path_divisors(const fixed_divisors_cache_type & cache_mgr,
MonomialSet::navigator a_nav,
MonomialSet::navigator m_nav,
MonomialSet::navigator n_nav){
if (n_nav.isTerminated()) return
MonomialSet(cache_mgr.generate(a_nav)).firstDivisorsOf(cache_mgr.generate(m_nav));
PBORI_ASSERT(!(n_nav.isConstant()&&(!(n_nav.terminalValue()))));
if (a_nav.isConstant()) return cache_mgr.generate(a_nav);
PBORI_ASSERT(!(n_nav.isConstant()));
PBORI_ASSERT(!(m_nav.isConstant()));
int m_index=*m_nav;
int n_index=*n_nav;
int a_index=*a_nav;
PBORI_ASSERT(m_index<=n_index);
//here we rely on the fact, that in Cudd deref of constant nav. gives a bigger index than allow allowed real indices
while((a_index=*a_nav)!=(m_index=*m_nav)){
if (a_index<m_index) a_nav.incrementElse();
else{
n_index=*n_nav;
PBORI_ASSERT(n_index>=m_index);
if (m_index==n_index){
n_nav.incrementThen();
m_nav.incrementThen();
} else {
m_nav.incrementThen();
}
}
}
n_index=*n_nav;
if (a_nav.isConstant()){
return cache_mgr.generate(a_nav);
}
PBORI_ASSERT((*a_nav)==(*m_nav));
MonomialSet::navigator cached;
#ifndef DANGEROUS_FIXED_PATH
cached =
cache_mgr.find(a_nav, m_nav,n_nav);
if (cached.isValid() ){
return cache_mgr.generate(cached);
}
#else
//MonomialSet::navigator cached =
//cache_mgr.find(a_nav, m_nav);
#endif
// here it is theoretically possible to get answers which don't contain the
// fixed path n, but that doesn't matter in practice,
// as it is optimization anyway
typedef PBORI::CacheManager<CCacheTypes::divisorsof>
cache_mgr_type2;
cache_mgr_type2 cache_mgr2(cache_mgr.manager());
cached =
cache_mgr2.find(a_nav, m_nav);
if (cached.isValid()){
return cache_mgr2.generate(cached);
}
PBORI_ASSERT(a_index==m_index);
int index=m_index;
MonomialSet result(cache_mgr.zero());
if (m_index==n_index){
result=do_fixed_path_divisors(cache_mgr, a_nav.thenBranch(),
m_nav.thenBranch(), n_nav.thenBranch());
if (!(result.isZero()))
result = MonomialSet(index, result, cache_mgr.zero());
} else {
MonomialSet
then_path=do_fixed_path_divisors(cache_mgr, a_nav.thenBranch(),
m_nav.thenBranch(), n_nav);
MonomialSet
else_path=do_fixed_path_divisors(cache_mgr, a_nav.elseBranch(),
m_nav.thenBranch(), n_nav);
if (then_path.isZero()){
result=else_path;
} else {
result=MonomialSet(index,then_path,else_path);
}
}
#ifndef DANGEROUS_FIXED_PATH
cache_mgr.insert(a_nav,m_nav,n_nav,result.navigation());
#else
cache_mgr2.insert(a_nav,m_nav,result.navigation());
#endif
return result;
}
// end of variant for navigator
// variant for MonomialSet
inline MonomialSet
do_fixed_path_divisors(MonomialSet a,
MonomialSet m, MonomialSet n){
//we assume that m is a multiple of n
MonomialSet::navigator m_nav=m.navigation();
MonomialSet::navigator n_nav=n.navigation();
MonomialSet::navigator a_nav=a.navigation();
typedef fixed_divisors_cache_type cache_mgr_type;
cache_mgr_type cache_mgr(a.ring());
return do_fixed_path_divisors(cache_mgr, a_nav, m_nav, n_nav);
}
inline MonomialSet
fixed_path_divisors(MonomialSet a, Monomial m, Monomial n){
PBORI_ASSERT(m.reducibleBy(n));
return do_fixed_path_divisors(a,m.diagram(),n.diagram());
}
END_NAMESPACE_PBORIGB
#endif /* polybori_groebner_fixed_path_divisors_h_ */
|