Changeset 276c3f in git


Ignore:
Timestamp:
Jul 5, 2011, 3:16:22 PM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
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
Location:
factory
Files:
4 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
  • factory/algext.h

    rfaf58f r276c3f  
    2020bool isEqual(int *a, int *b, int lower, int upper);
    2121CanonicalForm firstLC(const CanonicalForm & f);
    22 CanonicalForm reduce(const CanonicalForm & f, const CanonicalForm & M);
    2322
    2423#endif
  • factory/canonicalform.h

    rfaf58f r276c3f  
    257257
    258258int size ( const CanonicalForm & f );
     259
     260CanonicalForm reduce ( const CanonicalForm& f, const CanonicalForm & M);
    259261//}}}
    260262
  • 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.