Changeset 276c3f in git for factory/cf_ops.cc


Ignore:
Timestamp:
Jul 5, 2011, 3:16:22 PM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
e28e6d1742e673c091f48a99b5d6d522e5d5bfa2
Parents:
faf58fa448fff6919168c75277259dc4202064b0
Message:
moved 'reduce' from algext.* to cf_ops.cc and canonicalform.h


git-svn-id: file:///usr/local/Singular/svn/trunk@14325 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_ops.cc

    rfaf58f r276c3f  
    659659}
    660660//}}}
     661
     662CanonicalForm reduce(const CanonicalForm & f, const CanonicalForm & M)
     663{ // polynomials in M.mvar() are considered coefficients
     664  // M univariate monic polynomial
     665  // the coefficients of f are reduced modulo M
     666  if(f.inBaseDomain() || f.level() < M.level())
     667    return f;
     668  if(f.level() == M.level())
     669  {
     670    if(f.degree() < M.degree())
     671      return f;
     672    CanonicalForm tmp = mod (f, M);
     673    return tmp;
     674  }
     675  // here: f.level() > M.level()
     676  CanonicalForm result = 0;
     677  for(CFIterator i=f; i.hasTerms(); i++)
     678    result += reduce(i.coeff(),M) * power(f.mvar(),i.exp());
     679  return result;
     680}
Note: See TracChangeset for help on using the changeset viewer.