Changeset 276c3f in git for factory/algext.cc


Ignore:
Timestamp:
Jul 5, 2011, 3:16:22 PM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
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/algext.cc

    rfaf58f r276c3f  
    190190
    191191  return 1;
    192 }
    193 
    194 CanonicalForm reduce(const CanonicalForm & f, const CanonicalForm & M)
    195 { // polynomials in M.mvar() are considered coefficients
    196   // M univariate monic polynomial
    197   // the coefficients of f are reduced modulo M
    198   if(f.inBaseDomain() || f.level() < M.level())
    199     return f;
    200   if(f.level() == M.level())
    201   {
    202     if(f.degree() < M.degree())
    203       return f;
    204     CanonicalForm tmp = mod (f, M);
    205     return tmp;
    206   }
    207   // here: f.level() > M.level()
    208   CanonicalForm result = 0;
    209   for(CFIterator i=f; i.hasTerms(); i++)
    210     result += reduce(i.coeff(),M) * power(f.mvar(),i.exp());
    211   return result;
    212192}
    213193
Note: See TracChangeset for help on using the changeset viewer.