Changeset a64b0e in git for factory/algext.cc


Ignore:
Timestamp:
Nov 15, 2012, 2:17:37 PM (11 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
e2e4be38ca2210479e037e6d8c68c82be5b92ff1
Parents:
780b5285f9d867d03d9da5298c36e8bedf88eaf4
git-author:
Martin Lee <martinlee84@web.de>2012-11-15 14:17:37+01:00
git-committer:
Martin Lee <martinlee84@web.de>2012-11-16 13:13:23+01:00
Message:
chg: deleted unused tryDivide
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/algext.cc

    r780b52 ra64b0e  
    365365static CanonicalForm tryvcontent ( const CanonicalForm & f, const Variable & x, const CanonicalForm & M, bool & fail );
    366366static CanonicalForm trycf_content ( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm & M, bool & fail );
    367 static void tryDivide( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm & M, CanonicalForm & result, bool & divides, bool & fail );
    368367
    369368static inline CanonicalForm
     
    10191018}
    10201019
    1021 
    1022 static void tryDivide( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm & M, CanonicalForm & result, bool & divides, bool & fail )
    1023 { // M "univariate" monic polynomial
    1024   // f, g polynomials with coeffs modulo M.
    1025   // if f is divisible by g, 'divides' is set to 1 and 'result' == f/g mod M coefficientwise.
    1026   // 'fail' is set to 1, iff a zero divisor is encountered.
    1027   // divides==1 implies fail==0
    1028   // required: getReduce(M.mvar())==0
    1029   if(g.inBaseDomain())
    1030   {
    1031     result = f/g;
    1032     divides = true;
    1033     return;
    1034   }
    1035   if(g.inCoeffDomain())
    1036   {
    1037     tryInvert(g,M,result,fail);
    1038     if(fail)
    1039       return;
    1040     result = reduce(f*result, M);
    1041     divides = true;
    1042     return;
    1043   }
    1044   // here: g NOT inCoeffDomain
    1045   Variable x = g.mvar();
    1046   if(f.degree(x) < g.degree(x))
    1047   {
    1048     divides = false;
    1049     return;
    1050   }
    1051   // here: f.degree(x) > 0 and f.degree(x) >= g.degree(x)
    1052   CanonicalForm F = f;
    1053   CanonicalForm q, leadG = LC(g);
    1054   result = 0;
    1055   while(!F.isZero())
    1056   {
    1057     tryDivide(F.LC(x),leadG,M,q,divides,fail);
    1058     if(fail || !divides)
    1059       return;
    1060     if(F.degree(x)<g.degree(x))
    1061     {
    1062       divides = false;
    1063       return;
    1064     }
    1065     q *= power(x,F.degree(x)-g.degree(x));
    1066     result += q;
    1067     F = reduce(F-q*g, M);
    1068   }
    1069   result = reduce(result, M);
    1070   divides = true;
    1071 }
    1072 
    10731020void tryExtgcd( const CanonicalForm & F, const CanonicalForm & G, CanonicalForm & result, CanonicalForm & s, CanonicalForm & t, bool & fail )
    10741021{
Note: See TracChangeset for help on using the changeset viewer.