Changeset 7af488e in git for libpolys/coeffs/numbers.cc


Ignore:
Timestamp:
May 27, 2011, 11:39:02 AM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
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
File:
1 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;
Note: See TracChangeset for help on using the changeset viewer.