Example #1
0
	ExtensionManager::ExtensionManager( const std::vector<std::string>& vecKinds, CastFunction pFnCast, CreateFunction pFnCreate )
	{
		_vecKindFunctions_refCnt++;
		// Removed by PETER, but did not understand exactly why.
		// for ( int i = 0 ; i < vecKinds.size() ; i++ ) {
			ExtensionManager::vecKindFunctions().push_back( FunctionPair( pFnCast, pFnCreate ) );
		// }
	}
Example #2
0
// compute S polynomial for a pair
BRP sPolynomial(const Pair &pair, const IntermediateBasis &F, int n) {
  FunctionPair fp = FunctionPair(pair, F, n);
  if (!fp.good) {
    return BRP();
  }

  if (pair.i < 0 ) {
    // fp.g = x_i
    // f = ax + b
    BRP b = (fp.f)->remainder(*fp.g);
    return b * *fp.g + b;
  }
  brMonomial f = fp.f->LT();
  brMonomial g = fp.g->LT();
  brMonomial lcm = f | g;
  return *fp.f * (lcm ^ f ) + *fp.g * ( lcm ^ g );
}
Example #3
0
// return true if both functions with indeces of pair are in the intermediate basis and their S polynomial should be computed
bool isGoodPair(const Pair &pair, const IntermediateBasis &F, const Pairs &B, int n) {
  FunctionPair fp = FunctionPair(pair, F, n);
  if (!fp.good) {
    return false;
  }


  // both polynomials are monomials, so their S polynomial reduces to 0
  if ( fp.g->size() == 1 && fp.f->size() == 1 ) {
    //cout << "m ";
    return false;
  }

  brMonomial g = fp.g->LT();
  brMonomial f = fp.f->LT();
  if( BRP::isRelativelyPrime(g,f) ) {
    return false;
  }


  int i = pair.i;
  int j = pair.j;

  brMonomial lcm = pair.lcm;
  IntermediateBasis::const_iterator end = F.end();
  for(IntermediateBasis::const_iterator it = F.begin(); it != end; ++it) {
    int k = it->first;
    const BRP *K = &(it->second);

    if(( k != i && k != j && BRP::isDivisibleBy(lcm, K->LT() ) && !inList(i,k,B,F) && !inList(j,k,B,F))) {
      return false;
    }
  }

  //cout << "good pair ";
  return true;
}