Changeset 7af488e in git for libpolys/coeffs


Ignore:
Timestamp:
May 27, 2011, 11:39:02 AM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
9bb545791780a99344a26d6177decb3870f6da87
Parents:
6ccdd3ad26bd7de442ab57e7cc95352fcf0de398
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-05-27 11:39:02+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:39:06+01:00
Message:
nRegister not needed any more for standard coeffs
Location:
libpolys/coeffs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/numbers.cc

    r6ccdd3a r7af488e  
    3030#endif
    3131
     32#ifdef HAVE_POLYEXTENSIONS
     33#include <polys/ext_fields/algext.h>
     34#endif
     35
    3236#ifdef HAVE_FACTORY
    3337#include <factory/factory.h>
     
    153157}
    154158
    155 static n_coeffType nLastCoeffs=n_Z2m;
    156 static cfInitCharProc *nInitCharTable=NULL;
     159static n_coeffType nLastCoeffs=n_CF;
     160cfInitCharProc nInitCharTableDefault[]=
     161{ NULL,        /*n_unknown */
     162 npInitChar,   /* n_Zp */
     163 nlInitChar,   /* n_Q */
     164 nrInitChar,   /* n_R */
     165 nfInitChar,   /* n_GF */
     166 ngfInitChar,  /* n_long_R */
     167 #ifdef HAVE_POLYEXTENSIONS
     168 naInitChar,  /* n_algExt */
     169 #else
     170 NULL,        /* n_algExt */
     171 #endif
     172 NULL, /* n_transExt */
     173 ngcInitChar,  /* n_long_C */
     174 #ifdef HAVE_RINGS
     175 nrzInitChar,  /* n_Z */
     176 nrnInitChar,  /* n_Zn */
     177 NULL,         /* n_Zpn */
     178 nr2mInitChar, /* n_Z2m */
     179 #else
     180 NULL,         /* n_Z */
     181 NULL,         /* n_Zn */
     182 NULL,         /* n_Zpn */
     183 NULL,         /* n_Z2m */
     184 #endif
     185 NULL   /* n_CF */
     186};
     187
     188static cfInitCharProc *nInitCharTable=nInitCharTableDefault;
    157189/*2
    158190* init operations for coeffs r
     
    206238    BOOLEAN nOK=TRUE;
    207239    // init
    208     if ((nInitCharTable!=NULL) && (t<=nLastCoeffs))
     240    if ((t<=nLastCoeffs) && (nInitCharTable[t]!=NULL))
    209241      nOK = (nInitCharTable[t])(n,parameter);
    210242    else
    211        Werror("coeff init missing for %d",(int)t);
     243       Werror("nInitCharTable[%d] missing",(int)t);
    212244    if (nOK)
    213245    {
     
    311343}
    312344
     345
    313346n_coeffType nRegister(n_coeffType n, cfInitCharProc p)
    314347{
     
    316349  {
    317350    nLastCoeffs=(n_coeffType)(int(nLastCoeffs)+1);
    318     if (nInitCharTable==NULL)
     351    if (nInitCharTable==nInitCharTableDefault)
    319352    {
    320353      nInitCharTable=(cfInitCharProc*)omAlloc0(
    321354                                          nLastCoeffs*sizeof(cfInitCharProc));
     355      memcpy(nInitCharTable,nInitCharTableDefault,
     356              (nLastCoeffs-1)*sizeof(cfInitCharProc));
    322357    }
    323358    else
     
    333368  else
    334369  {
    335     if (nInitCharTable==NULL)
    336     {
    337       nInitCharTable=(cfInitCharProc*)omAlloc0(
    338                                          ((int) nLastCoeffs)*sizeof(cfInitCharProc));
    339     }
     370    if (nInitCharTable[n]!=NULL) Print("coeff %d already initialized\n",n);
    340371    nInitCharTable[n]=p;
    341372    return n;
  • libpolys/coeffs/test.cc

    r6ccdd3a r7af488e  
    274274#ifdef HAVE_RINGS
    275275//  TODO(Frank, Segmentation fault! (if used wihout omalloc???). Please_ investigate!);
    276   type = nRegister( n_Z2m, nr2mInitChar); assume( type == n_Z2m );
     276  type =  n_Z2m;
    277277  if( Test(type, (void*) 4) )
    278278    c ++;
    279279#endif
    280280
    281   type = nRegister( n_Zp, npInitChar); assume( type == n_Zp );
     281  type =  n_Zp;
    282282  if( Test(type, (void*) 101) )
    283283    c ++;
     
    286286//  TODO(Frank, memmory corruption_ if used wihout omalloc??? Please_ investigate!);
    287287
    288   type = nRegister( n_Z2m, nr2mInitChar); assume( type == n_Z2m );
     288  type = n_Z2m;
    289289  if( Test(type, (void*) 8) )
    290290    c ++;
     
    293293
    294294 
    295   type = nRegister( n_Q, nlInitChar); assume( type == n_Q );
    296   if( Test(type) )
    297     c ++;
    298 
    299   type = nRegister( n_R, nrInitChar); assume( type == n_R );
    300   if( Test(type) )
    301     c ++;
    302 
    303 #ifdef HAVE_RINGS
    304   type = nRegister( n_Z, nrzInitChar); assume( type == n_Z ); // No need in GMP?
    305   if( Test(type) )
    306     c ++;
    307 #endif
    308    type = nRegister( n_GF, nfInitChar); assume( type == n_GF );
     295  type =  n_Q;
     296  if( Test(type) )
     297    c ++;
     298
     299  type = n_R;
     300  if( Test(type) )
     301    c ++;
     302
     303#ifdef HAVE_RINGS
     304  type = n_Z;
     305  if( Test(type) )
     306    c ++;
     307#endif
     308   type = n_GF;
    309309
    310310
     
    340340//  TODO(Somebody, This will result in memory corruption at Z_2^m later on (due to the succs. setGMPFloatDigits?)...!?); // ????
    341341
    342   type = nRegister( n_Zn, nrnInitChar); assume( type == n_Zn );
     342  type = n_Zn;
    343343
    344344  if( Test(type, (void*) 3) )
     
    351351
    352352
    353   type = nRegister( n_long_C, ngcInitChar); assume( type == n_long_C );
    354   if( Test(type) )
    355     c ++;
    356 
    357   type = nRegister( n_long_R, ngfInitChar); assume( type == n_long_R );
    358   if( Test(type) )
    359     c ++;
    360 
    361 #ifdef HAVE_RINGS
    362   type = nRegister( n_Z2m, nr2mInitChar); assume( type == n_Z2m );
     353  type = n_long_C;
     354  if( Test(type) )
     355    c ++;
     356
     357  type = n_long_R;
     358  if( Test(type) )
     359    c ++;
     360
     361#ifdef HAVE_RINGS
     362  type = n_Z2m;
    363363  if( Test(type, (void*) 2) )
    364364    c ++;
     
    367367
    368368#ifdef HAVE_RINGS
    369   type = nRegister( n_Zn, nrnInitChar); assume( type == n_Zn );
     369  type = n_Zn;
    370370
    371371  if( Test(type, (void*) 3) )
Note: See TracChangeset for help on using the changeset viewer.