Changeset 1629ab in git


Ignore:
Timestamp:
Aug 14, 2009, 7:14:30 PM (14 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
a2787db38eefc1420adf5a8707671c1901ead89f
Parents:
1a76b926417798b97d4f503af69e8a461bb9ce4a
Message:
*hannes: cleanup longalg


git-svn-id: file:///usr/local/Singular/svn/trunk@12071 2c84dea3-7e68-4137-9b89-c4e89433aadc
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Singular/mpsr_GetPoly.cc

    r1a76b9 r1629ab  
    33****************************************/
    44
    5 /* $Id: mpsr_GetPoly.cc,v 1.35 2005-05-18 15:59:36 Singular Exp $ */
     5/* $Id: mpsr_GetPoly.cc,v 1.36 2009-08-14 17:13:42 Singular Exp $ */
    66
    77/***************************************************************
     
    320320
    321321  failr(GetAlgNumberNumber(link, &(napGetCoeff(a))));
    322   mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &gTa, naNumbOfPar));
    323   for (i=0; i<naNumbOfPar; i++)
     322  mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &gTa, rPar(currRing)));
     323  for (i=0; i<rPar(currRing); i++)
    324324    napSetExp(a,i+1,gTa[i]);
    325325
    326326  for (j=1; j<nm; j++)
    327327  {
    328     napNext(a) = napNew();
    329     napIter(a);
     328    pNext(a) = napNew();
     329    pIter(a);
    330330    failr(GetAlgNumberNumber(link, &(napGetCoeff(a))));
    331     mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &gTa, naNumbOfPar));
    332     for (i=0; i<naNumbOfPar; i++)
     331    mp_failr(IMP_GetSint32Vector(link, (MP_Sint32_t **) &gTa, rPar(currRing)));
     332    for (i=0; i<rPar(currRing); i++)
    333333      napSetExp(a,i+1,gTa[i]);
    334334  }
    335   napNext(a) = NULL;
     335  pNext(a) = NULL;
    336336
    337337  return mpsr_Success;
  • Singular/mpsr_PutPoly.cc

    r1a76b9 r1629ab  
    33****************************************/
    44
    5 /* $Id: mpsr_PutPoly.cc,v 1.23 2004-04-13 15:38:03 Singular Exp $ */
     5/* $Id: mpsr_PutPoly.cc,v 1.24 2009-08-14 17:13:42 Singular Exp $ */
    66
    77/***************************************************************
     
    222222        gTa[i] = p_GetExp((poly)a,i+1,ar);
    223223      mp_failr(IMP_PutSint32Vector(link, gTa, gNalgvars));
    224       napIter(a);
     224      pIter(a);
    225225    }
    226226  else
     
    230230      failr(PutAlgAlgNumber(link, napGetCoeff(a)));
    231231      IMP_PutSint32(link, (MP_Sint32_t) p_GetExp((poly)a,1,ar));
    232       napIter(a);
     232      pIter(a);
    233233    }
    234234  }
  • kernel/clapconv.cc

    r1a76b9 r1629ab  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapconv.cc,v 1.16 2009-08-13 15:31:27 Singular Exp $
     5// $Id: clapconv.cc,v 1.17 2009-08-14 17:14:29 Singular Exp $
    66/*
    77* ABSTRACT: convert data between Singular and factory
     
    337337      term *= power( a , e );
    338338    result += term;
    339     p = napNext( p );
     339    p = pNext( p );
    340340  }
    341341  return result;
     
    377377  {
    378378    t=napNew();
    379     // napNext( t ) = NULL; //already done by napNew
     379    // pNext( t ) = NULL; //already done by napNew
    380380    napGetCoeff(t)=convFactoryNSingAN( i.coeff() );
    381381    if (n_IsZero(napGetCoeff(t),currRing->algring))
    382382    {
    383       napDelete(&t);
     383      p_Delete(&t,nacRing);
    384384    }
    385385    else
  • kernel/clapsing.cc

    r1a76b9 r1629ab  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapsing.cc,v 1.43 2009-08-13 15:31:27 Singular Exp $
     5// $Id: clapsing.cc,v 1.44 2009-08-14 17:14:30 Singular Exp $
    66/*
    77* ABSTRACT: interface between Singular and factory
     
    8181      {
    8282        bool b=isOn(SW_USE_QGCD);
    83         if ( nGetChar()==1 ) On(SW_USE_QGCD);
     83        if ( rField_is_Q_a() ) On(SW_USE_QGCD);
    8484        CanonicalForm mipo=convSingPFactoryP(((lnumber)r->minpoly)->z,
    8585                                           r->algring);
     
    157157  // for now there is only the possibility to handle polynomials over
    158158  // Q and Fp ...
    159   if (( nGetChar() == 0 || nGetChar() > 1 )
    160   && (currRing->parameter==NULL))
     159  if (rField_is_Zp() || rField_is_Q())
    161160  {
    162161    Variable X(i);
     
    168167  }
    169168  // and over Q(a) / Fp(a)
    170   else if (( nGetChar()==1 ) /* Q(a) */
    171   || (nGetChar() <-1))       /* Fp(a) */
    172   {
    173     if (nGetChar()==1) setCharacteristic( 0 );
     169  else if (rField_is_Extension())
     170  {
     171    if (rField_is_Q_a()) setCharacteristic( 0 );
    174172    else               setCharacteristic( -nGetChar() );
    175173    poly res;
     
    291289  res=NULL;pa=NULL;pb=NULL;
    292290  On(SW_SYMMETRIC_FF);
    293   if (( nGetChar() == 0 || nGetChar() > 1 )
    294   && (currRing->parameter==NULL))
     291  if (rField_is_Zp() || rField_is_Q())
    295292  {
    296293    setCharacteristic( nGetChar() );
     
    312309  }
    313310  // and over Q(a) / Fp(a)
    314   else if (( nGetChar()==1 ) /* Q(a) */
    315   || (nGetChar() <-1))       /* Fp(a) */
    316   {
    317     if (nGetChar()==1) setCharacteristic( 0 );
     311  else if (rField_is_Extension())
     312  {
     313    if (rField_is_Q_a()) setCharacteristic( 0 );
    318314    else               setCharacteristic( -nGetChar() );
    319315    CanonicalForm Fa,Gb;
     
    439435poly singclap_pdivide ( poly f, poly g )
    440436{
    441   // for now there is only the possibility to handle polynomials over
    442   // Q and Fp ...
    443437  poly res=NULL;
    444438  On(SW_RATIONAL);
    445   if (( nGetChar() == 0 || nGetChar() > 1 )
    446   && (currRing->parameter==NULL))
     439  if (rField_is_Zp() || rField_is_Q())
    447440  {
    448441    setCharacteristic( nGetChar() );
     
    450443    res = convFactoryPSingP( F / G );
    451444  }
    452   // and over Q(a) / Fp(a)
    453   else if (( nGetChar()==1 ) /* Q(a) */
    454   || (nGetChar() <-1))       /* Fp(a) */
    455   {
    456     if (nGetChar()==1) setCharacteristic( 0 );
     445  else if (rField_is_Extension())
     446  {
     447    if (rField_is_Q_a()) setCharacteristic( 0 );
    457448    else               setCharacteristic( -nGetChar() );
    458449    if (currRing->minpoly!=NULL)
     
    498489  else
    499490  {
    500     if ( nGetChar() == 1 )
     491    if ( rField_is_Q_a() )
    501492      setCharacteristic( 0 );
    502     else  if ( nGetChar() == -1 )
    503       return; /* not implemented for R */
    504     else  if ( nGetChar() < 0 )
     493    else  if ( rField_is_Zp_a() )
    505494      setCharacteristic( -nGetChar() );
    506     else if (currRing->parameter==NULL) /* not GF(q) */
    507       setCharacteristic( nGetChar() );
    508495    else
    509496      return; /* not implemented*/
     
    572559      {
    573560        lnumber c=(lnumber)pGetCoeff(p);
    574         napDelete(&c->z);
     561        p_Delete(&c->z,nacRing);
    575562        c->z=convFactoryPSingP( i.getItem() / g, currRing->algring );
    576563        //nTest((number)c);
     
    608595    CanonicalForm F, FAC,Q,R;
    609596    Variable a;
    610     if (( nGetChar() == 0 || nGetChar() > 1 )
    611     && (currRing->parameter==NULL))
     597    if (rField_is_Zp() || rField_is_Q())
    612598    {
    613599      F=convSingPFactoryP( f );
    614600      FAC=convSingPFactoryP( fac );
    615601    }
    616     // and over Q(a) / Fp(a)
    617     else if (( nGetChar()==1 ) /* Q(a) */
    618     || (nGetChar() <-1))       /* Fp(a) */
     602    else if (rField_is_Extension())
    619603    {
    620604      if (currRing->minpoly!=NULL)
     
    645629      if (R.isZero())
    646630      {
    647         if (( nGetChar() == 0 || nGetChar() > 1 )
    648         && (currRing->parameter==NULL))
     631        if (rField_is_Zp() || rField_is_Q())
    649632        {
    650633          q = convFactoryPSingP( Q );
    651634        }
    652         else if (( nGetChar()==1 ) /* Q(a) */
    653         || (nGetChar() <-1))       /* Fp(a) */
     635        else if (rField_is_Extension())
    654636        {
    655637          if (currRing->minpoly!=NULL)
     
    807789    setCharacteristic( nGetChar() );
    808790    CanonicalForm F( convSingPFactoryP( f ) );
    809     if (nGetChar()==0) /* Q */
     791    if (rField_is_Q())
    810792    {
    811793      L = factorize( F );
  • kernel/longalg.cc

    r1a76b9 r1629ab  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longalg.cc,v 1.46 2009-08-13 15:31:27 Singular Exp $ */
     4/* $Id: longalg.cc,v 1.47 2009-08-14 17:14:30 Singular Exp $ */
    55/*
    66* ABSTRACT:   algebraic numbers
     
    3131naIdeal naI=NULL;
    3232
    33 int naNumbOfPar;
    3433napoly naMinimalPoly;
    3534#define naParNames (currRing->parameter)
     
    6665static BOOLEAN napDivPoly(napoly p, napoly q);
    6766static int napExpi(int i, napoly a, napoly b);
    68 static ring nacRing;
     67      ring nacRing;
    6968
    7069#define napCopy(p)       (napoly)p_Copy((poly)p,nacRing)
     
    8079    int j;
    8180    for (j=naI->anz-1; j>=0; j--)
    82        napDelete (&naI->liste[j]);
     81       p_Delete (&naI->liste[j],nacRing);
    8382    omFreeSize((ADDRESS)naI->liste,naI->anz*sizeof(napoly));
    8483    omFreeBin((ADDRESS)naI, snaIdeal_bin);
     
    107106  }
    108107
    109   naNumbOfPar=rPar(r);
    110108  if (i == 1)
    111109  {
     
    156154    if (naIsChar0)
    157155      nlDBTest(napGetCoeff(p), "", 0);
    158     napIter(p);
     156    pIter(p);
    159157  }
    160158}
     
    202200
    203201  qq = (napoly)p_Init(nacRing);
    204   napNext(qq) = NULL;
     202  pNext(qq) = NULL;
    205203  p_Normalize(g,nacRing);
    206204  p_Normalize(f,nacRing);
     
    232230
    233231  qq = (napoly)p_Init(nacRing);
    234   napNext(qq) = b = NULL;
     232  pNext(qq) = b = NULL;
    235233  p_Normalize(g,nacRing);
    236234  p_Normalize(f,nacRing);
     
    297295    n_Delete(&t,nacRing);
    298296    p_Normalize(qa,nacRing);
    299     napDelete(&x);
    300     napDelete(&r);
     297    p_Delete(&x,nacRing);
     298    p_Delete(&r,nacRing);
    301299    return qa;
    302300  }
     
    317315    p_Normalize(q,nacRing);
    318316    n_Delete(&t,nacRing);
    319     napDelete(&x);
    320     napDelete(&r);
     317    p_Delete(&x,nacRing);
     318    p_Delete(&r,nacRing);
    321319    if (napGetExp(q,1) >= napGetExp(c,1))
    322320      q = napRemainder(q, c);
     
    346344      p_Normalize(q,nacRing);
    347345      n_Delete(&t,nacRing);
    348       napDelete(&x);
    349       napDelete(&r);
     346      p_Delete(&x,nacRing);
     347      p_Delete(&r,nacRing);
    350348      if (napGetExp(q,1) >= napGetExp(c,1))
    351349        q = napRemainder(q, c);
     
    373371  {
    374372    d=si_max(d,napDeg(p));
    375     napIter(p);
     373    pIter(p);
    376374  }
    377375  return d;
     
    388386  {
    389387    d=si_max(d,napDeg(p));
    390     napIter(p);
     388    pIter(p);
    391389    ll++;
    392390  }
     
    435433      }
    436434      int  i;
    437       for (i = 0; i < naNumbOfPar; i++)
     435      for (i = 0; i < rPar(currRing); i++)
    438436      {
    439437        if (napGetExp(p,i+1) > 0)
     
    452450        }
    453451      } /*for*/
    454       napIter(p);
     452      pIter(p);
    455453      if (p==NULL)
    456454        break;
     
    520518      return s;
    521519    }
    522     if (i >= naNumbOfPar)
     520    if (i >= rPar(currRing))
    523521      break;
    524522  }
     
    532530    else
    533531      i = 0;
    534     if ((*s == '\0') || (i >= naNumbOfPar))
     532    if ((*s == '\0') || (i >= rPar(currRing)))
    535533      break;
    536534  }
     
    541539static int napExp(napoly a, napoly b)
    542540{
    543   while (napNext(a)!=NULL) napIter(a);
     541  while (pNext(a)!=NULL) pIter(a);
    544542  int m = napGetExp(a,1);
    545543  if (m==0) return 0;
    546   while (napNext(b)!=NULL) napIter(b);
     544  while (pNext(b)!=NULL) pIter(b);
    547545  int mm=napGetExp(b,1);
    548546  if (m > mm) m = mm;
     
    559557  int m = napGetExp(a,i+1);
    560558  if (m==0) return 0;
    561   while (napNext(a) != NULL)
    562   {
    563     napIter(a);
     559  while (pNext(a) != NULL)
     560  {
     561    pIter(a);
    564562    if (m > napGetExp(a,i+1))
    565563    {
     
    575573      if (m==0) return 0;
    576574    }
    577     napIter(b);
     575    pIter(b);
    578576  }
    579577  while (b != NULL);
     
    590588    return;
    591589  h = nacCopy(napGetCoeff(p));
    592   napIter(p);
     590  pIter(p);
    593591  do
    594592  {
     
    602600    n_Delete(&h,nacRing);
    603601    h = d;
    604     napIter(p);
     602    pIter(p);
    605603  }
    606604  while (p!=NULL);
     
    613611    n_Delete(&napGetCoeff(p),nacRing);
    614612    napGetCoeff(p) = d;
    615     napIter(p);
     613    pIter(p);
    616614  }
    617615  n_Delete(&h,nacRing);
     
    632630    n_Delete(&h,nacRing);
    633631    h = d;
    634     napIter(p);
     632    pIter(p);
    635633  }
    636634  if(!nacIsOne(h))
     
    651649  if (nacIsOne(x))
    652650    return napInitz(x);
    653   while (napNext(a)!=NULL)
    654   {
    655     napIter(a);
     651  while (pNext(a)!=NULL)
     652  {
     653    pIter(a);
    656654    y = nacGcd(x, napGetCoeff(a), nacRing);
    657655    n_Delete(&x,nacRing);
     
    667665    if (nacIsOne(x))
    668666      return napInitz(x);
    669     napIter(b);
     667    pIter(b);
    670668  }
    671669  while (b!=NULL);
     
    681679  napoly g, x, y, h;
    682680  if ((a==NULL)
    683   || ((napNext(a)==NULL)&&(nacIsZero(napGetCoeff(a)))))
     681  || ((pNext(a)==NULL)&&(nacIsZero(napGetCoeff(a)))))
    684682  {
    685683    if ((b==NULL)
    686     || ((napNext(b)==NULL)&&(nacIsZero(napGetCoeff(b)))))
     684    || ((pNext(b)==NULL)&&(nacIsZero(napGetCoeff(b)))))
    687685    {
    688686      return napInit(1);
     
    692690  else
    693691  if ((b==NULL)
    694   || ((napNext(b)==NULL)&&(nacIsZero(napGetCoeff(b)))))
     692  || ((pNext(b)==NULL)&&(nacIsZero(napGetCoeff(b)))))
    695693  {
    696694    return napCopy(a);
     
    710708    if (!naIsChar0) g = napInit(1);
    711709    else            g = napGcd0(x, y);
    712     if (napNext(y)==NULL)
     710    if (pNext(y)==NULL)
    713711    {
    714712      napSetExp(g,1, napExp(x, y));
     
    732730        return y;
    733731      }
    734       else if (napNext(h)==NULL)
     732      else if (pNext(h)==NULL)
    735733        break;
    736734      x = y;
    737735      y = h;
    738736    }
    739     napDelete(&y);
     737    p_Delete(&y,nacRing);
    740738    napDelete1(&h);
    741739    napSetExp(g,1, napExp(a, b));
     
    749747  if (!naIsChar0) x = napInit(1);
    750748  else            x = napGcd0(g,h);
    751   for (i=(naNumbOfPar-1); i>=0; i--)
     749  for (i=(rPar(currRing)-1); i>=0; i--)
    752750  {
    753751    napSetExp(x,i+1, napExpi(i,a,b));
     
    772770      n_Delete(&h,nacRing);
    773771      h = d;
    774       napIter(b);
     772      pIter(b);
    775773    }
    776774  }
     
    791789  {
    792790    j++;
    793     if (j > naNumbOfPar)
     791    if (j > rPar(currRing))
    794792      return 1;
    795793  }
     
    814812      /* h = lt(q)/lt(naI->liste[i])*/
    815813      napGetCoeff(h) = nacCopy(napGetCoeff(q));
    816       for (j=naNumbOfPar; j>0; j--)
     814      for (j=rPar(currRing); j>0; j--)
    817815        napSetExp(h,j, napGetExp(q,j) - napGetExp(naI->liste[i],j));
    818816      p_Setm(h,nacRing);
     
    820818      h = napNeg (h);
    821819      q = napAdd (q, napCopy(h));
    822       napDelete (&napNext(h));
     820      p_Delete (&pNext(h),nacRing);
    823821      if (q == NULL)
    824822      {
    825         napDelete(&h);
     823        p_Delete(&h,nacRing);
    826824        return q;
    827825      }
     
    834832      if (i >= naI->anz)
    835833      {
    836         napDelete(&h);
     834        p_Delete(&h,nacRing);
    837835        return q;
    838836      }
     
    852850  napoly h;
    853851
    854   h = napNext(q);
     852  h = pNext(q);
    855853  while (h != NULL)
    856854  {
     
    858856     if (h == NULL)
    859857        return q;
    860      napIter(h);
     858     pIter(h);
    861859  }
    862860  return q;
     
    10471045  }
    10481046  if ((x!=NULL) && (napIsConstant(x)) && nacIsOne(napGetCoeff(x)))
    1049     napDelete(&x);
     1047    p_Delete(&x,nacRing);
    10501048  lo->n = x;
    10511049  if(lo->z==NULL)
     
    10931091  naNormalize(nres);
    10941092
    1095   //napDelete(&res->n);
     1093  //p_Delete(&res->n,nacRing);
    10961094  naTest(nres);
    10971095  return nres;
     
    11471145  }
    11481146  if ((napIsConstant(x)) && nacIsOne(napGetCoeff(x)))
    1149     napDelete(&x);
     1147    p_Delete(&x,nacRing);
    11501148  lo->n = x;
    11511149  if (lo->n!=NULL)
     
    12181216    {
    12191217      nacNormalize(napGetCoeff(x));
    1220       napIter(x);
     1218      pIter(x);
    12211219    }
    12221220  }
     
    13551353    return NULL;
    13561354  int i;
    1357   char *s=(char *)omAlloc(4* naNumbOfPar);
     1355  char *s=(char *)omAlloc(4* rPar(currRing));
    13581356  char *t=(char *)omAlloc(8);
    13591357  s[0]='\0';
    1360   for (i = 0; i <= naNumbOfPar - 1; i++)
     1358  for (i = 0; i <= rPar(currRing) - 1; i++)
    13611359  {
    13621360    if (napGetExp(ph->z,i+1) > 0)
     
    14461444        n_Delete(&t,nacRing);
    14471445    }
    1448     napIter(x);
    1449     napIter(y);
     1446    pIter(x);
     1447    pIter(y);
    14501448  }
    14511449  while ((x!=NULL) && (y!=NULL));
    14521450  if ((x!=NULL) || (y!=NULL)) return FALSE;
    1453   napDelete(&a->z);
    1454   napDelete(&a->n);
     1451  p_Delete(&a->z,nacRing);
     1452  p_Delete(&a->n,nacRing);
    14551453  a->z = napInit(1);
    14561454  a->n = NULL;
     
    15121510  x = (lnumber)a;
    15131511  y = (lnumber)b;
    1514   if ((naNumbOfPar == 1) && (naMinimalPoly!=NULL))
    1515   {
    1516     if (napNext(x->z)!=NULL)
     1512  if ((rPar(currRing) == 1) && (naMinimalPoly!=NULL))
     1513  {
     1514    if (pNext(x->z)!=NULL)
    15171515      result->z = napCopy(x->z);
    15181516    else
     
    15401538    else
    15411539    {
    1542       napDelete(&rz);
     1540      p_Delete(&rz,nacRing);
    15431541      result->z=convFactoryPSingP( F*R, nacRing );
    15441542      p_Normalize(result->z,nacRing);
     
    15521550
    15531551/*2
    1554 * naNumbOfPar = 1:
     1552* rPar(currRing) = 1:
    15551553* clears denominator         algebraic case;
    15561554* tries to simplify ratio    transcendental case;
     
    15581556* cancels monomials
    15591557* occuring in denominator
    1560 * and enumerator  ?          naNumbOfPar != 1;
     1558* and enumerator  ?          rPar(currRing) != 1;
    15611559*
    15621560*/
     
    15951593    {
    15961594      nacNormalize(napGetCoeff(x));
    1597       napIter(x);
     1595      pIter(x);
    15981596    }
    15991597    x = p->z;
     
    16051603    {
    16061604      nacNormalize(napGetCoeff(y));
    1607       napIter(y);
     1605      pIter(y);
    16081606    }
    16091607    y = p->n;
     
    16171615    {
    16181616      nacNormalize(napGetCoeff(x));
    1619       napIter(x);
     1617      pIter(x);
    16201618    }
    16211619    x = p->z;
     
    16231621    {
    16241622      nacNormalize(napGetCoeff(y));
    1625       napIter(y);
     1623      pIter(y);
    16261624    }
    16271625    y = p->n;
     
    16301628  {
    16311629    int i;
    1632     for (i=naNumbOfPar-1; i>=0; i--)
     1630    for (i=rPar(currRing)-1; i>=0; i--)
    16331631    {
    16341632      napoly xx=x;
     
    16401638        {
    16411639          napAddExp(xx,i+1, -m);
    1642           napIter(xx);
     1640          pIter(xx);
    16431641        }
    16441642        while (yy != NULL)
    16451643        {
    16461644          napAddExp(yy,i+1, -m);
    1647           napIter(yy);
     1645          pIter(yy);
    16481646        }
    16491647      }
     
    16681666    return;
    16691667  }
    1670   if (naNumbOfPar == 1) /* apply built-in gcd */
     1668  if (rPar(currRing) == 1) /* apply built-in gcd */
    16711669  {
    16721670    napoly x1,y1;
     
    16851683    {
    16861684      r = napRemainder(x1, y1);
    1687       if ((r==NULL) || (napNext(r)==NULL)) break;
     1685      if ((r==NULL) || (pNext(r)==NULL)) break;
    16881686      x1 = y1;
    16891687      y1 = r;
     
    16911689    if (r!=NULL)
    16921690    {
    1693       napDelete(&r);
    1694       napDelete(&y1);
     1691      p_Delete(&r,nacRing);
     1692      p_Delete(&y1,nacRing);
    16951693    }
    16961694    else
     
    16981696      napDivMod(x, y1, &(p->z), &r);
    16991697      napDivMod(y, y1, &(p->n), &r);
    1700       napDelete(&y1);
     1698      p_Delete(&y1,nacRing);
    17011699    }
    17021700    x = p->z;
     
    17121710      {
    17131711        nacNormalize(napGetCoeff(x));
    1714         napIter(x);
     1712        pIter(x);
    17151713      }
    17161714      x = p->z;
     
    17181716      {
    17191717        nacNormalize(napGetCoeff(y));
    1720         napIter(y);
     1718        pIter(y);
    17211719      }
    17221720      y = p->n;
    17231721    }
    1724     if (napNext(y)==NULL)
     1722    if (pNext(y)==NULL)
    17251723    {
    17261724      if (nacIsOne(napGetCoeff(y)))
     
    17451743      p->z=xx;
    17461744      p->n=yy;
    1747       napDelete(&x);
    1748       napDelete(&y);
     1745      p_Delete(&x,nacRing);
     1746      p_Delete(&y,nacRing);
    17491747    }
    17501748  }
     
    17591757  }
    17601758  number g=nacCopy(napGetCoeff(x));
    1761   napIter(x);
     1759  pIter(x);
    17621760  while (x!=NULL)
    17631761  {
     
    17721770    n_Delete(&g,nacRing);
    17731771    g = d;
    1774     napIter(x);
     1772    pIter(x);
    17751773  }
    17761774  while (y!=NULL)
     
    17861784    n_Delete(&g,nacRing);
    17871785    g = d;
    1788     napIter(y);
     1786    pIter(y);
    17891787  }
    17901788  x=p->z;
     
    17941792    number d = nacIntDiv(napGetCoeff(x),g);
    17951793    napSetCoeff(x,d);
    1796     napIter(x);
     1794    pIter(x);
    17971795  }
    17981796  while (y!=NULL)
     
    18001798    number d = nacIntDiv(napGetCoeff(y),g);
    18011799    napSetCoeff(y,d);
    1802     napIter(y);
     1800    pIter(y);
    18031801  }
    18041802  n_Delete(&g,nacRing);
     
    18391837      n_Delete(&bt,nacRing);
    18401838      n_Delete(&r,nacRing);
    1841       napIter(xx);
     1839      pIter(xx);
    18421840    }
    18431841  }
     
    18481846  {
    18491847    result->z=singclap_alglcm(result->z,b->n);
    1850     napDelete(&x);
     1848    p_Delete(&x,nacRing);
    18511849  }
    18521850#endif
     
    18681866  {
    18691867    for (i=naI->anz-1; i>=0; i--)
    1870       napDelete(&naI->liste[i]);
     1868      p_Delete(&naI->liste[i],nacRing);
    18711869    omFreeBin((ADDRESS)naI, snaIdeal_bin);
    18721870    naI=NULL;
     
    19961994  loop
    19971995  {
    1998     napIter(p);
     1996    pIter(p);
    19991997    if (p==NULL) break;
    2000     napNext(a) = (napoly)p_Init(nacRing);
    2001     napIter(a);
     1998    pNext(a) = (napoly)p_Init(nacRing);
     1999    pIter(a);
    20022000    for(i=1;i<=naParsToCopy;i++)
    20032001      napSetExp(a,i,napGetExpFrom(p,i,napMapRing));
     
    20052003    napGetCoeff(a) = nacMap(napGetCoeff(p));
    20062004  }
    2007   napNext(a) = NULL;
     2005  pNext(a) = NULL;
    20082006  return w;
    20092007}
     
    20322030    napGetCoeff(w) = nMap(napGetCoeff(p));
    20332031    p_Setm(w,nacRing);
    2034     napIter(p);
     2032    pIter(p);
    20352033    if (!not_null)
    20362034    {
     
    20482046      else
    20492047      {
    2050         napNext(w)=napPerm(p,par_perm,src_ring,nMap);
     2048        pNext(w)=napPerm(p,par_perm,src_ring,nMap);
    20512049        return w;
    20522050      }
     
    20832081        erg->n = napRemainder(erg->n, naMinimalPoly);
    20842082      if ((napIsConstant(erg->n)) && nacIsOne(napGetCoeff(erg->n)))
    2085         napDelete(&(erg->n));
     2083        p_Delete(&(erg->n),nacRing);
    20862084    }
    20872085  }
     
    22582256      res=pAdd(res,p);
    22592257    }
    2260     napIter(za);
     2258    pIter(za);
    22612259  }
    22622260  while (za!=NULL);
     
    23262324    if (naIsChar0 && !(nlDBTest(napGetCoeff(p),f,l)))
    23272325      return FALSE;
    2328     napIter(p);
     2326    pIter(p);
    23292327  }
    23302328  p = naGetDenom0(x);
     
    23332331    if (naIsChar0 && !(nlDBTest(napGetCoeff(p),f,l)))
    23342332      return FALSE;
    2335     napIter(p);
     2333    pIter(p);
    23362334  }
    23372335  return TRUE;
  • kernel/longalg.h

    r1a76b9 r1629ab  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: longalg.h,v 1.14 2009-08-07 13:55:21 Singular Exp $ */
     6/* $Id: longalg.h,v 1.15 2009-08-14 17:14:30 Singular Exp $ */
    77/*
    88* ABSTRACT:   algebraic numbers
     
    2222};
    2323
    24 extern int naNumbOfPar;             /* maximal number of parameters */
     24extern napoly naMinimalPoly;
     25extern ring nacRing;
    2526
    26 extern napoly naMinimalPoly;
    2727
    2828void naSetChar(int p, ring r);
     
    7272#define napNeg(p)              (p_Neg(p,currRing->algring))
    7373#define napVariables           naNumbOfPar
    74 #define napNext(p)             pNext(p)
    75 #define napIter(p)             pIter(p)
    7674#define napGetCoeff(p)         pGetCoeff(p)
    7775#define napGetExp(p,i)         (p_GetExp(p,i,currRing->algring))
    7876#define napGetExpFrom(p,i,r)   (p_GetExp(p,i,r->algring))
    7977#define napSetExp(p,i,e)       (p_SetExp(p,i,e,currRing->algring))
    80 #define napDelete(p)           p_Delete(p, currRing->algring)
    8178#define napNew()               (p_Init(currRing->algring))
    8279#define napAdd(p1,p2)          (p_Add_q(p1,p2,currRing->algring))
Note: See TracChangeset for help on using the changeset viewer.