Changeset c6eecb in git


Ignore:
Timestamp:
Apr 26, 2007, 10:22:48 AM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
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
Location:
factory
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • factory/NTLconvert.cc

    rcb637f rc6eecb  
    1 /* $Id: NTLconvert.cc,v 1.21 2007-03-01 12:17:24 Singular Exp $ */
     1/* $Id: NTLconvert.cc,v 1.22 2007-04-26 08:22:48 Singular Exp $ */
    22#include <config.h>
    33
     
    4949#endif
    5050
     51int fac_NTL_char=-1;            // the current characterstic for NTL calls
     52                                // -1: undefined
    5153#ifdef NTL_CLIENT               // in <NTL/tools.h>: using of name space NTL
    5254NTL_CLIENT
  • factory/NTLconvert.h

    rcb637f rc6eecb  
    1 /* $Id: NTLconvert.h,v 1.8 2007-04-25 11:00:51 Singular Exp $ */
     1/* $Id: NTLconvert.h,v 1.9 2007-04-26 08:22:48 Singular Exp $ */
    22#ifndef INCL_NTLCONVERT_H
    33#define INCL_NTLCONVERT_H
     
    5858CFFList convertNTLvec_pair_zzpEX_long2FacCFFList(vec_pair_zz_pEX_long e,zz_pE multi,Variable x,Variable alpha);
    5959
     60extern int fac_NTL_char;
    6061#endif
    6162#endif
  • factory/cf_factor.cc

    rcb637f rc6eecb  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_factor.cc,v 1.31 2007-04-25 11:13:34 Singular Exp $ */
     2/* $Id: cf_factor.cc,v 1.32 2007-04-26 08:22:48 Singular Exp $ */
    33
    44//{{{ docu
     
    8080}
    8181
    82 #if 0
     82#if 1
     83#ifndef NOSTREAMIO
    8384void out_cf(char *s1,const CanonicalForm &f,char *s2)
    8485{
     
    161162}
    162163#endif
     164#endif
    163165
    164166bool isPurePoly(const CanonicalForm & f)
     
    347349      {
    348350        // set remainder
    349         #ifdef NTL_ZZ
    350         ZZ r;
    351         r=getCharacteristic();
    352         ZZ_pContext ccc(r);
    353         #else
    354         zz_pContext ccc(getCharacteristic());
    355         #endif
    356         ccc.restore();
    357         #ifdef NTL_ZZ
    358         ZZ_p::init(r);
    359         #else
    360         zz_p::init(getCharacteristic());
    361         #endif
     351        if (fac_NTL_char!=getCharacteristic())
     352        {
     353          fac_NTL_char=getCharacteristic();
     354          #ifdef NTL_ZZ
     355          ZZ r;
     356          r=getCharacteristic();
     357          ZZ_pContext ccc(r);
     358          #else
     359          zz_pContext ccc(getCharacteristic());
     360          #endif
     361          ccc.restore();
     362          #ifdef NTL_ZZ
     363          ZZ_p::init(r);
     364          #else
     365          zz_p::init(getCharacteristic());
     366          #endif
     367        }
    362368        // convert to NTL
    363369        #ifdef NTL_ZZ
     
    390396      {
    391397        // Specialcase characteristic==2
    392         ZZ r;r=2;
    393         ZZ_p::init(r);
    394 
    395         // remainder is 2 --> nothing to set
    396 
     398        if (fac_NTL_char!=2)
     399        {
     400          fac_NTL_char=2;
     401          zz_p::init(2);
     402        }
    397403        // convert to NTL using the faster conversion routine for characteristic 2
    398404        GF2X f1=convertFacCF2NTLGF2X(f);
     
    531537      // First all cases with characteristic !=2
    532538      // set remainder
    533       #ifdef NTL_ZZ
    534       ZZ r;
    535       r=getCharacteristic();
    536       ZZ_pContext ccc(r);
    537       ccc.restore();
    538       #else
    539       zz_pContext ccc(getCharacteristic());
    540       ccc.restore();
    541       #endif
     539      if (fac_NTL_char!=getCharacteristic())
     540      {
     541        fac_NTL_char=getCharacteristic();
     542        #ifdef NTL_ZZ
     543        ZZ r;
     544        r=getCharacteristic();
     545        ZZ_pContext ccc(r);
     546        #else
     547        zz_pContext ccc(getCharacteristic());
     548        #endif
     549        ccc.restore();
     550        #ifdef NTL_ZZ
     551        ZZ_p::init(r);
     552        #else
     553        zz_p::init(getCharacteristic());
     554        #endif
     555      }
    542556
    543557      // set minimal polynomial in NTL
  • 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.