Changeset 601105 in git for libpolys/coeffs


Ignore:
Timestamp:
Nov 19, 2013, 6:39:47 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
448b6571955b81192b53dc7300bb54a1984142e3
Parents:
9d864add8f262ed66a3af97f514c37d01844334c
Message:
chg: use syzComp in initenterstrongPairs
Location:
libpolys/coeffs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/coeffs.h

    r9d864a r601105  
    7777
    7878/// Creation data needed for finite fields
    79 typedef struct 
     79typedef struct
    8080{
    8181  int GFChar;
     
    123123   // general stuff
    124124   numberfunc cfMult, cfSub ,cfAdd ,cfDiv, cfIntDiv, cfIntMod, cfExactDiv;
    125    
     125
    126126   /// init with an integer
    127127   number  (*cfInit)(long i,const coeffs r);
     
    129129   /// init with a GMP integer
    130130   number  (*cfInitMPZ)(mpz_t i, const coeffs r);
    131    
     131
    132132   /// how complicated, (0) => 0, or positive
    133133   int     (*cfSize)(number n, const coeffs r);
    134    
     134
    135135   /// convertion to int, 0 if impossible
    136136   int     (*cfInt)(number &n, const coeffs r);
     
    138138   /// Converts a non-negative number n into a GMP number, 0 if impossible
    139139   void     (*cfMPZ)(mpz_t result, number &n, const coeffs r);
    140    
     140
    141141   /// changes argument  inline: a:= -a
    142142   /// return -a! (no copy is returned)
     
    152152   /// print a given number (long format)
    153153   void    (*cfWriteLong)(number &a, const coeffs r);
    154    
     154
    155155   /// print a given number in a shorter way, if possible
    156156   /// e.g. in K(a): a2 instead of a^2
    157157   void    (*cfWriteShort)(number &a, const coeffs r);
    158    
     158
    159159   const char *  (*cfRead)(const char * s, number * a, const coeffs r);
    160160   void    (*cfNormalize)(number &a, const coeffs r);
    161    
     161
    162162#ifdef HAVE_RINGS
    163163   int     (*cfDivComp)(number a,number b,const coeffs r);
     
    167167#endif
    168168
    169    
     169
    170170   BOOLEAN (*cfGreater)(number a,number b, const coeffs r),
    171171            /// tests
     
    211211   /// create i^th parameter or NULL if not possible
    212212   number  (*cfParameter)(const int i, const coeffs r);
    213        
     213
    214214   /// function pointer behind n_ClearContent
    215215   nCoeffsEnumeratorFunc cfClearContent;
     
    230230
    231231   /// the 0 as constant, NULL by default
    232    number nNULL; 
     232   number nNULL;
    233233   int     char_flag;
    234234   int     ref;
     
    302302
    303303//  BOOLEAN   CanShortOut; //< if the elements can be printed in short format
    304 //                     // this is set to FALSE if a parameter name has >2 chars
     304//                       // this is set to FALSE if a parameter name has >2 chars
    305305//  BOOLEAN   ShortOut; //< if the elements should print in short format
    306306
     
    314314  unsigned short *m_nfPlus1Table;
    315315  int *m_nfMinPoly;
    316  
     316
    317317// ---------------------------------------------------
    318318// for Zp:
     
    608608#endif
    609609{
    610   assume(r != NULL); 
     610  assume(r != NULL);
    611611#ifdef LDEBUG
    612   assume(r->cfDBTest != NULL); 
     612  assume(r->cfDBTest != NULL);
    613613  return r->cfDBTest(n, filename, linenumber, r);
    614614#else
     
    640640static inline BOOLEAN nCoeff_is_Domain(const coeffs r)
    641641{
    642   assume(r != NULL); 
     642  assume(r != NULL);
    643643#ifdef HAVE_RINGS
    644644  return (getCoeffType(r)==n_Z || ((getCoeffType(r)!=n_Z2m) && (getCoeffType(r)!=n_Zn) && (getCoeffType(r)!=n_Znm)));
     
    679679
    680680static inline int n_ParDeg(number n, const coeffs r)
    681 { 
    682   assume(r != NULL); assume(r->cfParDeg != NULL); return r->cfParDeg(n,r); 
     681{
     682  assume(r != NULL); assume(r->cfParDeg != NULL); return r->cfParDeg(n,r);
    683683}
    684684
     
    697697  assume((iParameter >= 1) || (iParameter <= n_NumberOfParameters(r)));
    698698  assume(r->cfParameter != NULL);
    699   return r->cfParameter(iParameter, r); 
    700 }
    701 
     699  return r->cfParameter(iParameter, r);
     700}
    702701
    703702static inline number  n_Init_bigint(number i, const coeffs dummy,
    704                 const coeffs dst)
    705 {
    706   assume(dummy != NULL && dst != NULL); assume(dst->cfInit_bigint!=NULL); 
     703                const coeffs dst)
     704{
     705  assume(dummy != NULL && dst != NULL); assume(dst->cfInit_bigint!=NULL);
    707706  return dst->cfInit_bigint(i, dummy, dst);
    708707}
     
    710709static inline number  n_RePart(number i, const coeffs cf)
    711710{
    712   assume(cf != NULL); assume(cf->cfRePart!=NULL); 
     711  assume(cf != NULL); assume(cf->cfRePart!=NULL);
    713712  return cf->cfRePart(i,cf);
    714713}
    715714static inline number  n_ImPart(number i, const coeffs cf)
    716715{
    717   assume(cf != NULL); assume(cf->cfImPart!=NULL); 
     716  assume(cf != NULL); assume(cf->cfImPart!=NULL);
    718717  return cf->cfImPart(i,cf);
    719718}
  • libpolys/coeffs/modulop.cc

    r9d864a r601105  
    3535{
    3636  assume( getCoeffType(r) == ID );
    37  
     37
    3838#if SIZEOF_LONG == 4
    3939#define ULONG64 (unsigned long long)(unsigned long)
     
    4141#define ULONG64 (unsigned long)
    4242#endif
    43   return (number) 
     43  return (number)
    4444      (unsigned long)((ULONG64 a)*(ULONG64 b) % (ULONG64 r->ch));
    4545}
     
    5656{
    5757  assume( n_Test(k, r) );
    58  
     58
    5959  int h = (int)((long) k);
    6060  return ((int)h !=0) && (h <= (r->ch>>1));
     
    7878  number c = npMultM(a,b, r);
    7979  assume( n_Test(c, r) );
    80   return c; 
     80  return c;
    8181}
    8282
     
    9292  assume( n_Test(c, r) );
    9393  return c;
    94  
     94
    9595}
    9696
     
    102102{
    103103  assume( n_Test(n, r) );
    104  
     104
    105105  if ((long)n > (((long)r->ch) >>1)) return (int)((long)n -((long)r->ch));
    106106  else                               return (int)((long)n);
     
    111111  assume( n_Test(a, r) );
    112112  assume( n_Test(b, r) );
    113  
     113
    114114  number c = npAddM(a,b, r);
    115115
    116116  assume( n_Test(c, r) );
    117  
     117
    118118  return c;
    119119}
     
    123123  assume( n_Test(a, r) );
    124124  assume( n_Test(b, r) );
    125  
     125
    126126  number c = npSubM(a,b,r);
    127127
     
    134134{
    135135  assume( n_Test(a, r) );
    136  
     136
    137137  return 0 == (long)a;
    138138}
     
    141141{
    142142  assume( n_Test(a, r) );
    143  
     143
    144144  return 1 == (long)a;
    145145}
     
    148148{
    149149  assume( n_Test(a, r) );
    150  
     150
    151151  return ((r->npPminus1M == (long)a)&&((long)1!=(long)a));
    152152}
     
    231231    return (number)0;
    232232  number d;
    233  
     233
    234234#ifndef HAVE_DIV_MOD
    235235  if ((long)b==0)
     
    238238    return (number)0;
    239239  }
    240  
     240
    241241  int s = r->npLogTable[(long)a] - r->npLogTable[(long)b];
    242242  if (s < 0)
     
    250250  assume( n_Test(d, r) );
    251251  return d;
    252  
     252
    253253}
    254254number  npInvers (number c, const coeffs r)
    255255{
    256256  assume( n_Test(c, r) );
    257  
     257
    258258  if ((long)c==0)
    259259  {
     
    262262  }
    263263  number d = npInversM(c,r);
    264  
     264
    265265  assume( n_Test(d, r) );
    266266  return d;
    267  
     267
    268268}
    269269
     
    271271{
    272272  assume( n_Test(c, r) );
    273  
     273
    274274  if ((long)c==0) return c;
    275275
    276 #if 0 
    277   number d = npNegM(c,r); 
     276#if 0
     277  number d = npNegM(c,r);
    278278  assume( n_Test(d, r) );
    279279  return d;
    280280#else
    281   c = npNegM(c,r); 
     281  c = npNegM(c,r);
    282282  assume( n_Test(c, r) );
    283283  return c;
    284 #endif 
     284#endif
    285285}
    286286
     
    298298  assume( n_Test(a, r) );
    299299  assume( n_Test(b, r) );
    300  
     300
    301301//  return (long)a == (long)b;
    302  
     302
    303303  return npEqualM(a,b,r);
    304304}
     
    307307{
    308308  assume( n_Test(a, r) );
    309  
     309
    310310  if ((long)a>(((long)r->ch) >>1)) StringAppend("-%d",(int)(((long)r->ch)-((long)a)));
    311311  else                             StringAppend("%d",(int)((long)a));
     
    436436
    437437  assume( c > 0 );
    438  
     438
    439439  int i, w;
    440440
     
    507507  r->convFactoryNSingN=npConvFactoryNSingN;
    508508#endif
    509  
     509
    510510  // the variables:
    511511  r->nNULL = (number)0;
     
    539539                               % r->ch);
    540540          r->npLogTable[r->npExpTable[i]] = i;
    541           if /*(i == r->ch - 1 ) ||*/ (/*(*/ r->npExpTable[i] == 1 /*)*/) 
     541          if /*(i == r->ch - 1 ) ||*/ (/*(*/ r->npExpTable[i] == 1 /*)*/)
    542542            break;
    543543        }
     
    757757#else
    758758/// TODO: use "long InvMod(long a, const coeffs R)"?!
    759  
     759
    760760   long  s;
    761761
    762    long  u, u0, u1, u2, q, r; // v0, v1, v2, 
     762   long  u, u0, u1, u2, q, r; // v0, v1, v2,
    763763
    764764   u1=1; // v1=0;
  • libpolys/coeffs/modulop.h

    r9d864a r601105  
    1111// defines are in struct.h
    1212// define if a*b is with mod instead of tables
    13 //#define HAVE_MULT_MOD 
     13//#define HAVE_MULT_MOD
    1414// define if a/b is with mod instead of tables
    15 //#define HAVE_DIV_MOD 
     15//#define HAVE_DIV_MOD
    1616// define if an if should be used
    1717//#define HAVE_GENERIC_ADD
     
    7171//    double ab;
    7272//    long q, res;
    73 // 
     73//
    7474//    ab = ((double) ((int)a)) * ((double) ((int)b));
    7575//    q  = (long) (ab/((double) npPrimeM));  // q could be off by (+/-) 1
     
    8383static inline number npMultM(number a, number b, const coeffs r)
    8484{
    85   return (number) 
     85  return (number)
    8686    ((((unsigned long) a)*((unsigned long) b)) % ((unsigned long) r->ch));
    8787}
Note: See TracChangeset for help on using the changeset viewer.