Changeset 6fd69c in git


Ignore:
Timestamp:
Mar 22, 2011, 10:02:35 AM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
47a8626627fa6ec583d0e0d8c844f3fdce6e2930
Parents:
a50dd10b43b308045bb85fb3ef03438d27949214
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-03-22 10:02:35+01:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:04:08+01:00
Message:
napoly -> poly
Location:
libpolys/polys/ext_fields
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/ext_fields/longalg.cc

    ra50dd10 r6fd69c  
    3131{
    3232  int anz;
    33   napoly *liste;
     33  poly *liste;
    3434};
    3535typedef struct snaIdeal * naIdeal;
     
    4040
    4141int naNumbOfPar;
    42 napoly naMinimalPoly;
     42poly naMinimalPoly;
    4343#define naParNames (currRing->parameter)
    4444static int naIsChar0;
     
    5252#endif
    5353
    54 number (*naMap)(number from);
    55 /* procedure variables */
    56 static numberfunc
    57                 nacMult, nacSub, nacAdd, nacDiv, nacIntDiv;
    58 static number   (*nacGcd)(number a, number b, const ring r);
    59 static number   (*nacLcm)(number a, number b, const ring r);
    60 static number   (*nacInit)(int i, const ring r);
    61 static int      (*nacInt)(number &n, const ring r);
    62 static void     (*nacDelete)(number *a, const ring r);
    63 #undef n_Delete
    64 #define n_Delete(A,R) nacDelete(A,R)
    65        void     (*nacNormalize)(number &a);
    66 static number   (*nacNeg)(number a);
    67        number   (*nacCopy)(number a);
    68 static number   (*nacInvers)(number a);
    69        BOOLEAN  (*nacIsZero)(number a);
    70 static BOOLEAN  (*nacIsOne)(number a);
    71 static BOOLEAN  (*nacIsMOne)(number a);
    72 static BOOLEAN  (*nacGreaterZero)(number a);
    73 static const char   * (*nacRead) (const char *s, number *a);
    74 static napoly napRedp(napoly q);
    75 static napoly napTailred(napoly q);
    76 static BOOLEAN napDivPoly(napoly p, napoly q);
    77 static int napExpi(int i, napoly a, napoly b);
    78        ring nacRing;
    79 
    80 void naCoefNormalize(number pp);
    81 
    82 #define napCopy(p)       p_Copy(p,nacRing)
     54naIdeal naI = NULL;
     55poly  naMinimalPoly;
     56omBin   snaIdeal_bin = omGetSpecBin(sizeof(snaIdeal));
     57number  (*naMap)(number from);
     58//omBin lnumber_bin = omGetSpecBin(sizeof(slnumber));
     59//omBin rnumber_bin = omGetSpecBin(sizeof(snumber));
     60
     61void redefineFunctionPointers()
     62{
     63  n_Procs_s* n = currRing->cf;
     64  /* re-defining function pointers */
     65  n->cfDelete       = naDelete;
     66  n->nNormalize     = naNormalize;
     67  n->cfInit         = naInit;
     68  n->nPar           = naPar;
     69  n->nParDeg        = naParDeg;
     70  n->n_Int          = naInt;
     71  n->nAdd           = naAdd;
     72  n->nSub           = naSub;
     73  n->nMult          = naMult;
     74  n->nDiv           = naDiv;
     75  n->nExactDiv      = naDiv;
     76  n->nIntDiv        = naIntDiv;
     77  n->nNeg           = naNeg;
     78  n->nInvers        = naInvers;
     79  n->nCopy          = naCopy;
     80  n->cfCopy         = na_Copy;
     81  n->nGreater       = naGreater;
     82  n->nEqual         = naEqual;
     83  n->nIsZero        = naIsZero;
     84  n->nIsOne         = naIsOne;
     85  n->nIsMOne        = naIsMOne;
     86  n->nGreaterZero   = naGreaterZero;
     87  n->nGreater       = naGreater;
     88  n->cfWrite        = naWrite;
     89  n->nRead          = naRead;
     90  n->nPower         = naPower;
     91  n->nGcd           = naGcd;
     92  n->nLcm           = naLcm;
     93  n->cfSetMap       = naSetMap;
     94  n->nName          = naName;
     95  n->nSize          = naSize;
     96  n->cfGetDenom     = napGetDenom;
     97  n->cfGetNumerator = napGetNumerator;
     98#ifdef LDEBUG
     99  n->nDBTest        = naDBTest;
     100#endif
     101  /* re-defining global function pointers */
     102  nNormalize=naNormalize;
     103  nPar   = naPar;
     104  nParDeg= nParDeg;
     105  n_Int  = naInt;
     106  nAdd   = naAdd;
     107  nSub   = naSub;
     108  nMult  = naMult;
     109  nDiv   = naDiv;
     110  nExactDiv= naDiv;
     111  nIntDiv= naIntDiv;
     112  nNeg   = naNeg;
     113  nInvers= naInvers;
     114  nCopy  = naCopy;
     115  nGreater = naGreater;
     116  nEqual = naEqual;
     117  nIsZero = naIsZero;
     118  nIsOne = naIsOne;
     119  nIsMOne = naIsMOne;
     120  nGreaterZero = naGreaterZero;
     121  nGreater = naGreater;
     122  nRead = naRead;
     123  nPower = naPower;
     124  nGcd  = naGcd;
     125  nLcm  = naLcm;
     126  nName= naName;
     127  nSize  = naSize;
     128}
    83129
    84130static number nadGcd( number a, number b, const ring r) { return nacInit(1,r); }
     
    93139    for (j=naI->anz-1; j>=0; j--)
    94140       p_Delete (&naI->liste[j],nacRing);
    95     omFreeSize((void *)naI->liste,naI->anz*sizeof(napoly));
     141    omFreeSize((void *)naI->liste,naI->anz*sizeof(poly));
    96142    omFreeBin((void *)naI, snaIdeal_bin);
    97143    naI=NULL;
     
    112158    naI=(naIdeal)omAllocBin(snaIdeal_bin);
    113159    naI->anz=IDELEMS(r->minideal);
    114     naI->liste=(napoly*)omAlloc(naI->anz*sizeof(napoly));
     160    naI->liste=(poly*)omAlloc(naI->anz*sizeof(poly));
    115161    int j;
    116162    for (j=naI->anz-1; j>=0; j--)
     
    10191065  if (lb==NULL) return naCopy(la);
    10201066
    1021   napoly x, y;
     1067  poly x, y;
    10221068  lnumber lu;
    10231069  lnumber a = (lnumber)la;
     
    10311077  if (a->n!=NULL) y = pp_Mult_qq(b->z, a->n,nacRing);
    10321078  else            y = napCopy(b->z);
    1033   napoly res = napAdd(x, y);
     1079  poly res = napAdd(x, y);
    10341080  if (res==NULL)
    10351081  {
     
    10961142  #endif
    10971143
    1098   napoly x, y;
     1144  poly x, y;
    10991145  if (b->n!=NULL) x = pp_Mult_qq(a->z, b->n,nacRing);
    11001146  else            x = napCopy(a->z);
    11011147  if (a->n!=NULL) y = p_Mult_q(napCopy(b->z), napCopyNeg(a->n),nacRing);
    11021148  else            y = napCopyNeg(b->z);
    1103   napoly res = napAdd(x, y);
     1149  poly res = napAdd(x, y);
    11041150  if (res==NULL)
    11051151  {
     
    11441190  lnumber b = (lnumber)lb;
    11451191  lnumber lo;
    1146   napoly x;
     1192  poly x;
    11471193
    11481194  #ifdef LDEBUG
     
    12511297  lnumber a = (lnumber)la;
    12521298  lnumber b = (lnumber)lb;
    1253   napoly x;
     1299  poly x;
    12541300
    12551301  if (a==NULL)
     
    13311377  lnumber lo;
    13321378  lnumber b = (lnumber)a;
    1333   napoly x;
     1379  poly x;
    13341380
    13351381  if (b==NULL)
     
    14621508const char  *naRead(const char *s, number *p)
    14631509{
    1464   napoly x;
     1510  poly x;
    14651511  lnumber a;
    14661512  s = napRead(s, &x);
     
    15611607{
    15621608  lnumber a = (lnumber)za;
    1563   napoly x, y;
     1609  poly x, y;
    15641610  number t;
    15651611  if (a==NULL) return FALSE;
     
    16191665{
    16201666  lnumber a = (lnumber)za;
    1621   napoly x, y;
     1667  poly x, y;
    16221668  number t;
    16231669  if (a==NULL) return FALSE;
     
    16821728    setCharacteristic( c );
    16831729
    1684     napoly rz=napGcd(x->z, y->z);
     1730    poly rz=napGcd(x->z, y->z);
    16851731    CanonicalForm F, G, R;
    16861732    R=convSingPFactoryP(rz,r->algring);
     
    18361882  naCoefNormalize(pp);
    18371883  p->s = 2;
    1838   napoly x = p->z;
    1839   napoly y = p->n;
     1884  poly x = p->z;
     1885  poly y = p->n;
    18401886
    18411887  BOOLEAN norm=FALSE;
     
    18751921    for (i=naNumbOfPar-1; i>=0; i--)
    18761922    {
    1877       napoly xx=x;
    1878       napoly yy=y;
     1923      poly xx=x;
     1924      poly yy=y;
    18791925      int m = napExpi(i, yy, xx);
    18801926      if (m != 0)          // in this case xx!=NULL!=yy
     
    19141960  if (naNumbOfPar == 1) /* apply built-in gcd */
    19151961  {
    1916     napoly x1,y1;
     1962    poly x1,y1;
    19171963    if (p_GetExp(x,1,nacRing) >= p_GetExp(y,1,nacRing))
    19181964    {
     
    19251971      y1 = napCopy(x);
    19261972    }
    1927     napoly r;
     1973    poly r;
    19281974    loop
    19291975    {
     
    19862032#endif
    19872033  {
    1988     napoly xx,yy;
     2034    poly xx,yy;
    19892035    singclap_algdividecontent(x,y,xx,yy);
    19902036    if (xx!=NULL)
     
    20712117  naTest(la);
    20722118  naTest(lb);
    2073   napoly x = p_Copy(a->z, r->algring);
     2119  poly x = p_Copy(a->z, r->algring);
    20742120  number t = napLcm(b->z); // get all denom of b->z
    20752121  if (!nacIsOne(t))
    20762122  {
    20772123    number bt, rr;
    2078     napoly xx=x;
     2124    poly xx=x;
    20792125    while (xx!=NULL)
    20802126    {
     
    21232169    lnumber h;
    21242170    number a;
    2125     napoly x;
     2171    poly x;
    21262172
    21272173    naI=(naIdeal)omAllocBin(snaIdeal_bin);
    21282174    naI->anz=IDELEMS(I);
    2129     naI->liste=(napoly*)omAlloc(naI->anz*sizeof(napoly));
     2175    naI->liste=(poly*)omAlloc(naI->anz*sizeof(poly));
    21302176    for (i=IDELEMS(I)-1; i>=0; i--)
    21312177    {
     
    21562202  lnumber l=(lnumber)omAllocBin(rnumber_bin);
    21572203  l->s=2;
    2158   l->z=(napoly)p_Init(nacRing);
     2204  l->z=(poly)p_Init(nacRing);
    21592205  int i=(int)((long)c);
    21602206  if (i>((long)naMapRing->ch>>2)) i-=(long)naMapRing->ch;
     
    21722218  lnumber l=(lnumber)omAllocBin(rnumber_bin);
    21732219  l->s=0;
    2174   l->z=(napoly)p_Init(nacRing);
     2220  l->z=(poly)p_Init(nacRing);
    21752221  pGetCoeff(l->z)=nlCopy(c);
    21762222  l->n=NULL;
     
    21862232  lnumber l=(lnumber)omAllocBin(rnumber_bin);
    21872233  l->s=2;
    2188   l->z=(napoly)p_Init(nacRing);
     2234  l->z=(poly)p_Init(nacRing);
    21892235  pGetCoeff(l->z)=c; /* omit npCopy, because npCopy is a no-op */
    21902236  l->n=NULL;
     
    22042250  lnumber l=(lnumber)omAllocBin(rnumber_bin);
    22052251  l->s=2;
    2206   l->z=(napoly)p_Init(nacRing);
     2252  l->z=(poly)p_Init(nacRing);
    22072253  pGetCoeff(l->z)=n;
    22082254  l->n=NULL;
     
    22212267  lnumber l=(lnumber)omAllocBin(rnumber_bin);
    22222268  l->s=2;
    2223   l->z=(napoly)p_Init(nacRing);
     2269  l->z=(poly)p_Init(nacRing);
    22242270  pGetCoeff(l->z)=n;
    22252271  l->n=NULL;
     
    25372583  omCheckAddrSize(a, sizeof(snumber));
    25382584  #endif
    2539   napoly p = x->z;
     2585  poly p = x->z;
    25402586  if (p==NULL)
    25412587  {
  • libpolys/polys/ext_fields/longalg.h

    ra50dd10 r6fd69c  
    1010#include <coeffs/coeffs.h>
    1111#include <coeffs/longrat.h>
     12#include <polys/monomials/ring.h>
    1213#include <polys/monomials/polys-impl.h>
    1314#include <polys/ext_fields/longtrans.h>
     
    2526struct slnumber
    2627{
    27   napoly z;
    28   napoly n;
    29   BOOLEAN s;
     28  int anz;
     29  poly *liste;
    3030};
    31 
    32 extern napoly naMinimalPoly;
    33 extern ring nacRing;
    34 
     31typedef struct snaIdeal * naIdeal;
     32extern omBin snaIdeal_bin;
     33extern naIdeal naI;
     34extern poly naMinimalPoly;
    3535
    3636void naSetChar(int p, ring r);
  • libpolys/polys/ext_fields/longtrans.cc

    ra50dd10 r6fd69c  
    115115    for (j=naI->anz-1; j>=0; j--)
    116116       p_Delete (&naI->liste[j],nacRing);
    117     omFreeSize((ADDRESS)naI->liste,naI->anz*sizeof(napoly));
     117    omFreeSize((ADDRESS)naI->liste,naI->anz*sizeof(poly));
    118118    omFreeBin((ADDRESS)naI, snaIdeal_bin);
    119119    naI=NULL;
     
    159159
    160160#ifdef LDEBUG
    161 void napTest(napoly p)
     161void napTest(poly p)
    162162{
    163163  if (ntIsChar0)
     
    174174#endif
    175175
    176 /* creates a new napoly that consists of a
     176/* creates a new poly that consists of a
    177177   single coefficient (provided as a number);
    178178   the provided number is NOT const */
    179 napoly napInitz(number z)
    180 {
    181   napoly a = (napoly)p_Init(nacRing);
     179poly napInitz(number z)
     180{
     181  poly a = (poly)p_Init(nacRing);
    182182  pGetCoeff(a) = z;
    183183  return a;
    184184}
    185185
    186 /* creates a new napoly which is the
     186/* creates a new poly which is the
    187187   negative inverse of the argument;
    188188   keeps p */
    189 napoly napCopyNeg(const napoly p)
    190 {
    191   napoly r = napCopy(p);
    192   r = (napoly)p_Neg((poly)r, nacRing);
     189poly napCopyNeg(const poly p)
     190{
     191  poly r = napCopy(p);
     192  r = (poly)p_Neg((poly)r, nacRing);
    193193  return r;
    194194}
    195195
    196 /* modifies the napoly p to p*z, i.e.
     196/* modifies the poly p to p*z, i.e.
    197197   in-place multiplication of p with the number z;
    198198   keeps z */
    199 void napMultN(napoly p, const number z)
     199void napMultN(poly p, const number z)
    200200{
    201201  number t;
     
    216216   in f is greater than or equal to that in g
    217217   sets q, r; destroys f; keeps g */
    218 void napDivMod(napoly f, const napoly  g, napoly *q, napoly *r)
    219 {
    220   napoly a, h, b, qq;
    221 
    222   qq = (napoly)p_Init(nacRing);
     218void napDivMod(poly f, const poly  g, poly *q, poly *r)
     219{
     220  poly a, h, b, qq;
     221
     222  qq = (poly)p_Init(nacRing);
    223223  pNext(qq) = b = NULL;
    224224  p_Normalize(g, nacRing);
     
    253253   in f is greater than or equal to that in g
    254254   destroys f; keeps g; returns r */
    255 napoly napRemainder(napoly f, const napoly g)
    256 {
    257   napoly a, h, qq;
    258 
    259   qq = (napoly)p_Init(nacRing);
     255poly napRemainder(poly f, const poly g)
     256{
     257  poly a, h, qq;
     258
     259  qq = (poly)p_Init(nacRing);
    260260  pNext(qq) = NULL;
    261261  p_Normalize(g, nacRing);
     
    286286   some intermediate version of x is returned;
    287287   modifies x; keeps c */
    288 napoly napInvers(napoly x, const napoly c)
    289 {
    290   napoly y, r, qa, qn, q;
     288poly napInvers(poly x, const poly c)
     289{
     290  poly y, r, qa, qn, q;
    291291  number t;
    292292
     
    391391}
    392392
    393 /* the degree of a napoly, i.e. the
     393/* the degree of a poly, i.e. the
    394394   maximum of all terms' degrees;
    395395   keeps p */
    396 int napMaxDeg(napoly p)
     396int napMaxDeg(poly p)
    397397{
    398398  int  d = 0;
     
    405405}
    406406
    407 /* the degree of a napoly, i.e. the
     407/* the degree of a poly, i.e. the
    408408   maximum of all terms' degrees;
    409409   fills l with the number of terms;
    410410   keeps p */
    411 int napMaxDegLen(napoly p, int &l)
     411int napMaxDegLen(poly p, int &l)
    412412{
    413413  int d = 0;
     
    423423
    424424
    425 /* writes a napoly, i.e. a number in the ground field;
     425/* writes a poly, i.e. a number in the ground field;
    426426   if has_denom is TRUE, the output is ready to be
    427427   followed by a non-trivial denominator;
     
    429429   or transcendental field extension;
    430430   keeps all arguments */
    431 void napWrite(napoly p, const BOOLEAN has_denom, const ring r)
     431void napWrite(poly p, const BOOLEAN has_denom, const ring r)
    432432{
    433433  ring nacring = r->algring;
     
    484484
    485485/* helper for napRead */
    486 const char* napHandleMons(const char* s, int i, napoly ex)
     486const char* napHandleMons(const char* s, int i, poly ex)
    487487{
    488488  int j;
     
    502502
    503503/* helper for napRead */
    504 const char* napHandlePars(const char *s, int i, napoly ex)
     504const char* napHandlePars(const char *s, int i, poly ex)
    505505{
    506506  if (strcmp(s, ntParNames[i]) == 0)
     
    512512}
    513513
    514 /* reads a monomial into the napoly b;
     514/* reads a monomial into the poly b;
    515515   returns the latter portion of s which
    516516   comes "after" the monomial that has
    517517   just been read;
    518518   modifies b */
    519 const char* napRead(const char *s, napoly *b)
    520 {
    521   napoly a;
     519const char* napRead(const char *s, poly *b)
     520{
     521  poly a;
    522522  int i;
    523   a = (napoly)p_Init(nacRing);
     523  a = (poly)p_Init(nacRing);
    524524  if ((*s >= '0') && (*s <= '9'))
    525525  {
     
    564564   assumes a != NULL, b != NULL;
    565565   keeps a and b */
    566 int napExp(napoly a, napoly b)
     566int napExp(poly a, poly b)
    567567{
    568568  assume(a != NULL);
     
    580580   used to find it in a fraction;
    581581   keeps a and b */
    582 int napExpi(int i, napoly a, napoly b)
     582int napExpi(int i, poly a, poly b)
    583583{
    584584  if (a == NULL || b == NULL) return 0;
     
    610610   assumes that ph != NULL;
    611611   modifies ph */
    612 void napContent(napoly ph)
     612void napContent(poly ph)
    613613{
    614614  number h, d;
    615   napoly p;
     615  poly p;
    616616
    617617  assume(ph != NULL);
     
    650650   if char != 0, then nothing is done;
    651651   modifies ph */
    652 void napCleardenom(napoly ph)
     652void napCleardenom(poly ph)
    653653{
    654654  number d, h;
    655   napoly p;
     655  poly p;
    656656
    657657  if (!ntIsChar0) return;
     
    684684   assumes a != NULL, b != NULL;
    685685   keeps a, keeps b */
    686 napoly napGcd0(napoly a, napoly b)
     686poly napGcd0(poly a, poly b)
    687687{
    688688  number x, y;
     
    719719   if a != 0 = b, then a is returned;
    720720   keeps a, keeps b */
    721 napoly napGcd(napoly a, napoly b)
     721poly napGcd(poly a, poly b)
    722722{
    723723  int i;
    724   napoly g, x, y, h;
    725   if (a == NULL)
    726   {
    727     if (b == NULL)    return p_ISet(1,nacRing);
    728     else              return napCopy(b);
    729   }
    730   else if (b == NULL) return napCopy(a);
     724  poly g, x, y, h;
     725  if ((a==NULL)
     726  || ((pNext(a)==NULL)&&(nacIsZero(pGetCoeff(a)))))
     727  {
     728    if ((b==NULL)
     729    || ((pNext(b)==NULL)&&(nacIsZero(pGetCoeff(b)))))
     730    {
     731      return p_ISet(1,nacRing);
     732    }
     733    return napCopy(b);
     734  }
     735  else
     736  if ((b==NULL)
     737  || ((pNext(b)==NULL)&&(nacIsZero(pGetCoeff(b)))))
     738    return napCopy(a);
    731739 
    732740  if (naMinimalPoly != NULL)
     
    791799   if a = 0, then the constant poly 1 is returned;
    792800   keeps a */
    793 number napLcm(napoly a)
     801number napLcm(poly a)
    794802{
    795803  number h = nacInit(1,nacRing);
     
    797805  {
    798806    number d;
    799     napoly b = a;
     807    poly b = a;
     808
    800809    while (b!=NULL)
    801810    {
     
    814823* doesn't delete p and q
    815824*/
    816 BOOLEAN napDivPoly (napoly p, napoly q)
     825BOOLEAN napDivPoly (poly p, poly q)
    817826{
    818827  int j=1;   /* evtl. von naNumber.. -1 abwaerts zaehlen */
     
    833842 * modifies q and returns it
    834843 */
    835 napoly napRedp (napoly q)
    836 {
    837   napoly h = (napoly)p_Init(nacRing);
     844poly napRedp (poly q)
     845{
     846  poly h = (poly)p_Init(nacRing);
    838847  int i=0,j;
    839848
     
    878887 * modifies q and returns it
    879888 */
    880 napoly napTailred (napoly q)
    881 {
    882   napoly h;
     889poly napTailred (poly q)
     890{
     891  poly h;
    883892
    884893  h = pNext(q);
     
    893902}
    894903
    895 napoly napMap(napoly p)
    896 {
    897   napoly w, a;
     904poly napMap(poly p)
     905{
     906  poly w, a;
    898907
    899908  if (p==NULL) return NULL;
    900   a = w = (napoly)p_Init(nacRing);
     909  a = w = (poly)p_Init(nacRing);
    901910  int i;
    902911  for(i=1;i<=ntParsToCopy;i++)
     
    908917    pIter(p);
    909918    if (p==NULL) break;
    910     pNext(a) = (napoly)p_Init(nacRing);
     919    pNext(a) = (poly)p_Init(nacRing);
    911920    pIter(a);
    912921    for(i=1;i<=ntParsToCopy;i++)
     
    919928}
    920929
    921 napoly napPerm(napoly p,const int *par_perm,const ring src_ring,const nMapFunc nMap)
    922 {
    923   napoly w;
     930poly napPerm(poly p,const int *par_perm,const ring src_ring,const nMapFunc nMap)
     931{
     932  poly w;
    924933
    925934  if (p==NULL) return NULL;
    926   w = (napoly)p_Init(nacRing);
     935  w = (poly)p_Init(nacRing);
    927936  int i;
    928937  BOOLEAN not_null=TRUE;
     
    966975
    967976/*2
    968 * convert a napoly number into a poly
     977* convert a poly number into a poly
    969978*/
    970979poly napPermNumber(number z, int * par_perm, int P, ring oldRing)
     
    973982  poly res=NULL;
    974983  poly p;
    975   napoly za=((lnumber)z)->z;
    976   napoly zb=((lnumber)z)->n;
     984  poly za=((lnumber)z)->z;
     985  poly zb=((lnumber)z)->n;
    977986  nMapFunc nMap=naSetMap(oldRing,currRing); /* todo: check naSetMap
    978987                                                     vs. ntSetMap */
     
    990999    //for(i=pVariables;i;i--) pSetExp(p,i, 0); // done by pInit
    9911000    //if (rRing_has_Comp(currRing)) pSetComp(p, 0); // done by pInit
    992     napoly pa=NULL;
     1001    poly pa=NULL;
    9931002    lnumber pan;
    9941003    if (currRing->parameter!=NULL)
     
    11161125*  returns r and destroys f
    11171126*/
    1118 napoly ntRemainder(napoly f, const napoly g)
    1119 {
    1120   napoly a, h, qq;
    1121 
    1122   qq = (napoly)p_Init(nacRing);
     1127poly ntRemainder(poly f, const poly g)
     1128{
     1129  poly a, h, qq;
     1130
     1131  qq = (poly)p_Init(nacRing);
    11231132  pNext(qq) = NULL;
    11241133  p_Normalize(g, nacRing);
     
    12421251  if (lb==NULL) return ntCopy(la);
    12431252
    1244   napoly x, y;
     1253  poly x, y;
    12451254  lnumber lu;
    12461255  lnumber a = (lnumber)la;
     
    12541263  if (a->n!=NULL) y = pp_Mult_qq(b->z, a->n,nacRing);
    12551264  else            y = napCopy(b->z);
    1256   napoly res = napAdd(x, y);
     1265  poly res = napAdd(x, y);
    12571266  if (res==NULL)
    12581267  {
     
    13191328  #endif
    13201329
    1321   napoly x, y;
     1330  poly x, y;
    13221331  if (b->n!=NULL) x = pp_Mult_qq(a->z, b->n,nacRing);
    13231332  else            x = napCopy(a->z);
    13241333  if (a->n!=NULL) y = p_Mult_q(napCopy(b->z), napCopyNeg(a->n),nacRing);
    13251334  else            y = napCopyNeg(b->z);
    1326   napoly res = napAdd(x, y);
     1335  poly res = napAdd(x, y);
    13271336  if (res==NULL)
    13281337  {
     
    13671376  lnumber b = (lnumber)lb;
    13681377  lnumber lo;
    1369   napoly x;
     1378  poly x;
    13701379
    13711380  #ifdef LDEBUG
     
    14661475  lnumber a = (lnumber)la;
    14671476  lnumber b = (lnumber)lb;
    1468   napoly x;
     1477  poly x;
    14691478
    14701479  if (a==NULL)
     
    15271536  lnumber lo;
    15281537  lnumber b = (lnumber)a;
    1529   napoly x;
     1538  poly x;
    15301539
    15311540  if (b==NULL)
     
    16621671const char  *ntRead(const char *s, number *p)
    16631672{
    1664   napoly x;
     1673  poly x;
    16651674  lnumber a;
    16661675  s = napRead(s, &x);
     
    18601869  setCharacteristic( c );
    18611870
    1862   napoly rz=napGcd(x->z, y->z);
     1871  poly rz=napGcd(x->z, y->z);
    18631872  CanonicalForm F, G, R;
    18641873  R=convSingPFactoryP(rz,r->algring);
     
    20132022  ntCoefNormalize(pp);
    20142023  p->s = 2;
    2015   napoly x = p->z;
    2016   napoly y = p->n;
     2024  poly x = p->z;
     2025  poly y = p->n;
    20172026
    20182027  if (y==NULL) return;
     
    20232032    for (i=ntNumbOfPar-1; i>=0; i--)
    20242033    {
    2025       napoly xx=x;
    2026       napoly yy=y;
     2034      poly xx=x;
     2035      poly yy=y;
    20272036      int m = napExpi(i, yy, xx);
    20282037      if (m != 0)          // in this case xx!=NULL!=yy
     
    20622071  if (ntNumbOfPar == 1) /* apply built-in gcd */
    20632072  {
    2064     napoly x1,y1;
     2073    poly x1,y1;
    20652074    if (p_GetExp(x,1,nacRing) >= p_GetExp(y,1,nacRing))
    20662075    {
     
    20732082      y1 = napCopy(x);
    20742083    }
    2075     napoly r;
     2084    poly r;
    20762085    loop
    20772086    {
     
    21342143#endif
    21352144  {
    2136     napoly xx,yy;
     2145    poly xx,yy;
    21372146    singclap_algdividecontent(x,y,xx,yy);
    21382147    if (xx!=NULL)
     
    22132222  ntTest(la);
    22142223  ntTest(lb);
    2215   napoly x = p_Copy(a->z, r->algring);
     2224  poly x = p_Copy(a->z, r->algring);
    22162225  number t = napLcm(b->z); // get all denom of b->z
    22172226  if (!nacIsOne(t))
    22182227  {
    22192228    number bt, rr;
    2220     napoly xx=x;
     2229    poly xx=x;
    22212230    while (xx!=NULL)
    22222231    {
     
    22542263  lnumber l=ALLOC_LNUMBER();
    22552264  l->s=2;
    2256   l->z=(napoly)p_Init(nacRing);
     2265  l->z=(poly)p_Init(nacRing);
    22572266  int i=(int)((long)c);
    22582267  if (i>((long)ntMapRing->ch>>2)) i-=(long)ntMapRing->ch;
     
    22702279  lnumber l=ALLOC_LNUMBER();
    22712280  l->s=0;
    2272   l->z=(napoly)p_Init(nacRing);
     2281  l->z=(poly)p_Init(nacRing);
    22732282  pGetCoeff(l->z)=nlCopy(c);
    22742283  l->n=NULL;
     
    22842293  lnumber l=ALLOC_LNUMBER();
    22852294  l->s=2;
    2286   l->z=(napoly)p_Init(nacRing);
     2295  l->z=(poly)p_Init(nacRing);
    22872296  pGetCoeff(l->z)=c; /* omit npCopy, because npCopy is a no-op */
    22882297  l->n=NULL;
     
    23022311  lnumber l=ALLOC_LNUMBER();
    23032312  l->s=2;
    2304   l->z=(napoly)p_Init(nacRing);
     2313  l->z=(poly)p_Init(nacRing);
    23052314  pGetCoeff(l->z)=n;
    23062315  l->n=NULL;
     
    23192328  lnumber l=ALLOC_LNUMBER();
    23202329  l->s=2;
    2321   l->z=(napoly)p_Init(nacRing);
     2330  l->z=(poly)p_Init(nacRing);
    23222331  pGetCoeff(l->z)=n;
    23232332  l->n=NULL;
     
    24162425
    24172426/*2
    2418 * convert a napoly number into a poly
     2427* convert a poly number into a poly
    24192428*/
    24202429poly ntPermNumber(number z, int * par_perm, int P, ring oldRing)
     
    24232432  poly res=NULL;
    24242433  poly p;
    2425   napoly za=((lnumber)z)->z;
    2426   napoly zb=((lnumber)z)->n;
     2434  poly za=((lnumber)z)->z;
     2435  poly zb=((lnumber)z)->n;
    24272436  nMapFunc nMap=ntSetMap(oldRing,currRing);
    24282437  if (currRing->parameter!=NULL)
     
    24402449       pSetExp(p,i, 0);
    24412450    if (rRing_has_Comp(currRing)) pSetComp(p, 0);
    2442     napoly pa=NULL;
     2451    poly pa=NULL;
    24432452    lnumber pan;
    24442453    if (currRing->parameter!=NULL)
     
    25412550  omCheckAddrSize(a, sizeof(slnumber));
    25422551  #endif
    2543   napoly p = x->z;
     2552  poly p = x->z;
    25442553  if (p==NULL)
    25452554  {
  • libpolys/polys/ext_fields/longtrans.h

    ra50dd10 r6fd69c  
    4343*/
    4444
    45 typedef polyrec * napoly;
    4645struct slnumber;
    4746typedef struct slnumber * lnumber;
    4847struct slnumber
    4948{
    50   napoly z;
    51   napoly n;
     49  poly z;
     50  poly n;
    5251  BOOLEAN s;
    5352};
     
    9796BOOLEAN     ntDBTest(number a, const char *f,const int l);
    9897#endif
    99 napoly      ntRemainder(napoly f, const napoly  g);
     98poly      ntRemainder(poly f, const poly  g);
    10099void        ntSetIdeal(ideal I);
    101100void        ntCoefNormalize(number pp);
     
    135134#define napSetCoeff(p,n)       {n_Delete(&pGetCoeff(p),nacRing);pGetCoeff(p)=n;}
    136135#define napComp(p,q)           p_LmCmp((poly)p,(poly)q, nacRing)
    137 #define napMultT(A,E)          A=(napoly)p_Mult_mm((poly)A,(poly)E,nacRing)
     136#define napMultT(A,E)          A=(poly)p_Mult_mm((poly)A,(poly)E,nacRing)
    138137#define napDeg(p)              (int)p_Totaldegree(p, nacRing)
    139138number  napGetDenom(number &n, const ring r);
    140139number  napGetNumerator(number &n, const ring r);
    141 void    napTest(napoly p);
    142 napoly  napInitz(number z);
    143 napoly  napCopyNeg(const napoly p);
    144 void    napMultN(napoly p, const number z);
    145 void    napDivMod(napoly f, const napoly g, napoly *q, napoly *r);
    146 napoly  napRemainder(napoly f, const napoly g);
    147 napoly  napInvers(napoly x, const napoly c);
    148 int     napMaxDeg(napoly p);
    149 int     napMaxDegLen(napoly p, int &l);
    150 void    napWrite(napoly p,const BOOLEAN has_denom, const ring r);
    151 int     napExp(napoly a, napoly b);
    152 int     napExpi(int i, napoly a, napoly b);
    153 void    napContent(napoly ph);
    154 void    napCleardenom(napoly ph);
    155 napoly  napGcd0(napoly a, napoly b);
    156 napoly  napGcd(napoly a, napoly b);
    157 number  napLcm(napoly a);
    158 BOOLEAN napDivPoly (napoly p, napoly q);
    159 napoly  napRedp (napoly q);
    160 napoly  napTailred (napoly q);
    161 napoly  napMap(napoly p);
    162 napoly  napPerm(napoly p, const int *par_perm, const ring src_ring,
     140void    napTest(poly p);
     141poly  napInitz(number z);
     142poly  napCopyNeg(const poly p);
     143void    napMultN(poly p, const number z);
     144void    napDivMod(poly f, const poly g, poly *q, poly *r);
     145poly  napRemainder(poly f, const poly g);
     146poly  napInvers(poly x, const poly c);
     147int     napMaxDeg(poly p);
     148int     napMaxDegLen(poly p, int &l);
     149void    napWrite(poly p,const BOOLEAN has_denom, const ring r);
     150int     napExp(poly a, poly b);
     151int     napExpi(int i, poly a, poly b);
     152void    napContent(poly ph);
     153void    napCleardenom(poly ph);
     154poly  napGcd0(poly a, poly b);
     155poly  napGcd(poly a, poly b);
     156number  napLcm(poly a);
     157BOOLEAN napDivPoly (poly p, poly q);
     158poly  napRedp (poly q);
     159poly  napTailred (poly q);
     160poly  napMap(poly p);
     161poly  napPerm(poly p, const int *par_perm, const ring src_ring,
    163162                const nMapFunc nMap);
    164 const char* napHandleMons(const char *s, int i, napoly ex);
    165 const char* napHandlePars(const char *s, int i, napoly ex);
    166 const char* napRead(const char *s, napoly *b);
     163const char* napHandleMons(const char *s, int i, poly ex);
     164const char* napHandlePars(const char *s, int i, poly ex);
     165const char* napRead(const char *s, poly *b);
    167166
    168167#endif
Note: See TracChangeset for help on using the changeset viewer.