Exemple #1
0
bool DPoly::down_level(int newlevel, int oldlevel, poly &f)
{
  if (f == 0) return true;
  for (int i=oldlevel; i>newlevel; i--)
    {
      if (f->deg > 0)
        {
          dealloc_poly(f);
          return false;
        }
      poly g = f->arr.polys[0];
      f->arr.polys[0] = 0;
      dealloc_poly(f);
      f = g;
    }
  return true;
}
Exemple #2
0
void ARingTower::reset_degree(poly &f) const
{
  if (f == 0) return;
  int fdeg = f->deg;
  for (int j = fdeg; j >= 0; --j)
    if (f->polys[j] != 0)
      {
        f->deg = j;
        return;
      }
  // at this point, everything is 0!
  dealloc_poly(f);  // sets f to 0
}