Changeset c6eecb in git for factory/cf_gcd.cc


Ignore:
Timestamp:
Apr 26, 2007, 10:22:48 AM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
8251cc1c81aab678de3aec185a8de7969e825393
Parents:
cb637fad8051814719a0ea36ed4b65a20f1114cc
Message:
*hannes: avoid NTL char. switches


git-svn-id: file:///usr/local/Singular/svn/trunk@10002 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_gcd.cc

    rcb637f rc6eecb  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_gcd.cc,v 1.48 2006-09-25 12:33:11 Singular Exp $ */
     2/* $Id: cf_gcd.cc,v 1.49 2007-04-26 08:22:48 Singular Exp $ */
    33
    44#include <config.h>
     
    125125  && isPurePoly(f) && isPurePoly(g))
    126126  {
    127     zz_pContext ccc(getCharacteristic());
    128     ccc.restore();
    129     zz_p::init(getCharacteristic());
     127    if (fac_NTL_char!=getCharacteristic())
     128    {
     129      fac_NTL_char=getCharacteristic();
     130      #ifdef NTL_ZZ
     131      ZZ r;
     132      r=getCharacteristic();
     133      ZZ_pContext ccc(r);
     134      #else
     135      zz_pContext ccc(getCharacteristic());
     136      #endif
     137      ccc.restore();
     138      #ifdef NTL_ZZ
     139      ZZ_p::init(r);
     140      #else
     141      zz_p::init(getCharacteristic());
     142      #endif
     143    }
     144    #ifdef NTL_ZZ
     145    ZZ_pX F1=convertFacCF2NTLZZpX(f);
     146    ZZ_pX G1=convertFacCF2NTLZZpX(g);
     147    ZZ_pX R;
     148    ZZ_pX A,B;
     149    XGCD(R,A,B,F1,G1);
     150    a=convertNTLZZpX2CF(A,f.mvar());
     151    b=convertNTLZZpX2CF(B,f.mvar());
     152    return convertNTLZZpX2CF(R,f.mvar());
     153    #else
    130154    zz_pX F1=convertFacCF2NTLzzpX(f);
    131155    zz_pX G1=convertFacCF2NTLzzpX(g);
     
    136160    b=convertNTLzzpX2CF(B,f.mvar());
    137161    return convertNTLzzpX2CF(R,f.mvar());
     162    #endif
    138163  }
    139164#endif
     
    144169  CanonicalForm f0 = 1, f1 = 0, g0 = 0, g1 = 1, q, r;
    145170
    146   while ( ! p1.isZero() ) {
     171  while ( ! p1.isZero() )
     172  {
    147173      divrem( p0, p1, q, r );
    148174      p0 = p1; p1 = r;
     
    156182  b = g0 / ( contg * contp0 );
    157183  p0 /= contp0;
    158   if ( p0.sign() < 0 ) {
     184  if ( p0.sign() < 0 )
     185  {
    159186      p0 = -p0;
    160187      a = -a;
     
    696723gcd_univar_ntlp( const CanonicalForm & F, const CanonicalForm & G )
    697724{
     725  if (fac_NTL_char!=getCharacteristic())
     726  {
     727    fac_NTL_char=getCharacteristic();
     728    #ifdef NTL_ZZ
     729    ZZ r;
     730    r=getCharacteristic();
     731    ZZ_pContext ccc(r);
     732    #else
    698733    zz_pContext ccc(getCharacteristic());
     734    #endif
    699735    ccc.restore();
     736    #ifdef NTL_ZZ
     737    ZZ_p::init(r);
     738    #else
    700739    zz_p::init(getCharacteristic());
    701     zz_pX F1=convertFacCF2NTLzzpX(F);
    702     zz_pX G1=convertFacCF2NTLzzpX(G);
    703     zz_pX R=GCD(F1,G1);
    704     return  convertNTLzzpX2CF(R,F.mvar());
     740    #endif
     741  }
     742  #ifdef NTL_ZZ
     743  ZZ_pX F1=convertFacCF2NTLZZpX(F);
     744  ZZ_pX G1=convertFacCF2NTLZZpX(G);
     745  ZZ_pX R=GCD(F1,G1);
     746  return  convertNTLZZpX2CF(R,F.mvar());
     747  #else
     748  zz_pX F1=convertFacCF2NTLzzpX(F);
     749  zz_pX G1=convertFacCF2NTLzzpX(G);
     750  zz_pX R=GCD(F1,G1);
     751  return  convertNTLzzpX2CF(R,F.mvar());
     752  #endif
    705753}
    706754
Note: See TracChangeset for help on using the changeset viewer.