Changeset a86cda in git


Ignore:
Timestamp:
Nov 13, 2009, 4:46:24 PM (15 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '3720ae8bfcff4a4649ee98a15552089151d2d59b')
Children:
49b670025f701087621c75ff8954762da3857106
Parents:
06c40bf41a11dbc73a7e3d6ae746b9c0f3ace02a
Message:
*hannes: extgcd via NTL

git-svn-id: file:///usr/local/Singular/svn/trunk@12280 2c84dea3-7e68-4137-9b89-c4e89433aadc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/ChangeLog

    r06c40b ra86cda  
    22- adaption to svn
    33- new command: farey
    4 - test for basering over Q for chinrem
     4- test for basering over Q for chinrem/farey
    55- (some) memory leaks fixed in fast_map (track 183)
    6 - linalg.lib:inverse for real/complex unexcat coeffs fixed
     6- extgcd via NTL in char 0 (track 107)
     7- linalg.lib:inverse for real/complex inexact coeffs fixed
    78
    89Changes w.r.t 3-1-0-6:
  • factory/cf_gcd.cc

    r06c40b ra86cda  
    140140#ifdef HAVE_NTL
    141141  if (isOn(SW_USE_NTL_GCD_P) && ( getCharacteristic() > 0 )
    142   && isPurePoly(f) && isPurePoly(g))
     142  &&  (f.level()==g.level()) && isPurePoly(f) && isPurePoly(g))
    143143  {
    144144    if (fac_NTL_char!=getCharacteristic())
     
    179179    #endif
    180180  }
     181  if (isOn(SW_USE_NTL_GCD_0) && ( getCharacteristic() ==0)
     182  && (f.level()==g.level()) && isPurePoly(f) && isPurePoly(g))
     183  {
     184    CanonicalForm fc=bCommonDen(f);
     185    CanonicalForm gc=bCommonDen(g);
     186    ZZX F1=convertFacCF2NTLZZX(f*fc);
     187    ZZX G1=convertFacCF2NTLZZX(g*gc);
     188    ZZX R=GCD(F1,G1);
     189    CanonicalForm r=convertNTLZZX2CF(R,f.mvar());
     190    ZZ RR;
     191    ZZX A,B;
     192    if (r.inCoeffDomain())
     193    {
     194      XGCD(RR,A,B,F1,G1,1);
     195      CanonicalForm rr=convertZZ2CF(RR);
     196      ASSERT (!rr.isZero(), "NTL:XGCD failed");
     197      a=convertNTLZZX2CF(A,f.mvar())*fc/rr;
     198      b=convertNTLZZX2CF(B,f.mvar())*gc/rr;
     199      return CanonicalForm(1);
     200    }
     201    else
     202    {
     203      fc=bCommonDen(f);
     204      gc=bCommonDen(g);
     205      F1=convertFacCF2NTLZZX(f*fc/r);
     206      G1=convertFacCF2NTLZZX(g*gc/r);
     207      XGCD(RR,A,B,F1,G1,1);
     208      a=convertNTLZZX2CF(A,f.mvar())*fc;
     209      b=convertNTLZZX2CF(B,f.mvar())*gc;
     210      CanonicalForm rr=convertZZ2CF(RR);
     211      ASSERT (!rr.isZero(), "NTL:XGCD failed");
     212      r*=rr;
     213      if ( r.sign() < 0 ) { r= -r; a= -a; b= -b; }
     214      return r;
     215    }
     216  }
    181217#endif
     218  // may contain bug in the co-factors, see track 107
    182219  CanonicalForm contf = content( f );
    183220  CanonicalForm contg = content( g );
  • kernel/clapsing.cc

    r06c40b ra86cda  
    2323#include "ring.h"
    2424
    25 void out_cf(char *s1,const CanonicalForm &f,char *s2);
     25void out_cf(const char *s1,const CanonicalForm &f,const char *s2);
    2626
    2727poly singclap_gcd_r ( poly f, poly g, const ring r )
     
    351351    return TRUE;
    352352  }
     353#ifndef NDEBUG
     354  // checking the result of extgcd:
     355  poly dummy;
     356  dummy=pSub(pAdd(pMult(pCopy(f),pCopy(pa)),pMult(pCopy(g),pCopy(pb))),pCopy(res));
     357  if (dummy!=NULL)
     358  {
     359    PrintS("extgcd( ");pWrite(f);pWrite0(g);PrintS(" )\n");
     360    PrintS("gcd, co-factors:");pWrite(res); pWrite(pa);pWrite(pb);
     361    pDelete(&dummy);
     362  }
     363#endif 
    353364  return FALSE;
    354365}
     
    951962          if(!count_Factors(res,w,j,ff,convFactoryPSingTrP( J.getItem().factor() )))
    952963          {
    953             if (w!=NULL)
     964            if (w!=NULL)
    954965              (*w)[j]=1;
    955966            res->m[j]=pOne();
     
    960971          if (!count_Factors(res,w,j,ff,convFactoryAPSingAP( J.getItem().factor(),currRing )))
    961972          {
    962             if (w!=NULL)
     973            if (w!=NULL)
    963974              (*w)[j]=1;
    964975            res->m[j]=pOne();
Note: See TracChangeset for help on using the changeset viewer.