Changeset f6237dd in git


Ignore:
Timestamp:
Nov 12, 2012, 6:14:16 PM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '648d28f488f6ff08f5607ff229b9ad9e4a5b93c2')
Children:
4f6d994465bf76173207af0e9c819e5b06dbc566
Parents:
1e5c50f82763473c007a2714c91d4ac318709892
git-author:
Martin Lee <martinlee84@web.de>2012-11-12 18:14:16+01:00
git-committer:
Martin Lee <martinlee84@web.de>2012-11-16 13:22:07+01:00
Message:
chg: faster computation of resultants

Conflicts:

	factory/cfModResultant.cc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cfModResultant.cc

    r1e5c50 rf6237dd  
    1414
    1515#include "cf_assert.h"
     16#include "timing.h"
    1617
    1718#include "cfModResultant.h"
     
    2930#include "FLINTconvert.h"
    3031#endif
     32
     33TIMING_DEFINE_PRINT(fac_resultant_p)
    3134
    3235//TODO arrange by bound= deg (F,xlevel)*deg (G,i)+deg (G,xlevel)*deg (F, i)
     
    327330    return power (B, degAx);
    328331
     332  if (A.isUnivariate() && B.isUnivariate() && A.level() == B.level())
     333    return uniResultant (A, B);
     334
    329335  CanonicalForm F= A;
    330336  CanonicalForm G= B;
     
    337343
    338344  Variable y= Variable (2);
    339 
    340   if (F.isUnivariate() && G.isUnivariate() && F.level() == G.level())
    341     return N(uniResultant (F, G));
    342345
    343346  int i= -1;
     
    363366    if (H == modResult)
    364367      equalCount++;
     368    else
     369      equalCount= 0;
    365370
    366371    count++;
     
    473478  CanonicalForm resultModP, q (0), newResult, newQ;
    474479  CanonicalForm result;
     480  int equalCount= 0;
     481  CanonicalForm test, newTest;
     482  int count= 0;
    475483  do
    476484  {
     
    487495    setCharacteristic (p);
    488496
     497    TIMING_START (fac_resultant_p);
    489498    resultModP= resultantFp (mapinto (F), mapinto (G), X, prob);
     499    TIMING_END_AND_PRINT (fac_resultant_p, "time to compute resultant mod p: ");
    490500
    491501    setCharacteristic (0);
    492502
     503    count++;
    493504    if ( q.isZero() )
    494505    {
     
    501512      q= newQ;
    502513      result= newResult;
    503       if (newQ > bound)
    504       {
    505         result= symmetricRemainder (result, q);
     514      test= symmetricRemainder (result,q);
     515      if (test != newTest)
     516      {
     517        newTest= test;
     518        equalCount= 0;
     519      }
     520      else
     521        equalCount++;
     522      if (newQ > bound || (prob && equalCount == 2))
     523      {
     524        result= test;
    506525        break;
    507526      }
Note: See TracChangeset for help on using the changeset viewer.