Changeset 311499 in git for Singular/polys.inc


Ignore:
Timestamp:
May 28, 1998, 6:50:55 PM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
3939bce4295208a7c089668825e3a510f02ca7a7
Parents:
27b7998492f70ad316fe2f33dee8479b2b99a977
Message:
* hannes: DRING-changes


git-svn-id: file:///usr/local/Singular/svn/trunk@2007 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/polys.inc

    r27b799 r311499  
    1919/* pVariables=pdN*2+1+pdK */
    2020
    21 void pdSetDFlag(poly p, int i)
     21void pdSetDFlagP(poly p, int i)
    2222{
    2323  while (p!=NULL)
    2424  {
    25     pdDFlag(p)=1;
     25    pdSetDFlag(p,1);
    2626    pSetm(p);
    2727    pIter(p);
     
    3939  poly e2=pOne();
    4040
    41   pdDFlag(e1)=1;
    42   pdDFlag(e2)=1;
     41  pdSetDFlag(e1,1);
     42  pdSetDFlag(e2,1);
    4343  number t;
    4444
    4545  if (x==1)
    4646  {
    47     e1->exp[pdX(n)]=1;
    48     e1->exp[pdDX(n)]=d;
     47    pSetExp(e1,pdX(n),1);
     48    pSetExp(e1,pdDX(n),d);
    4949    pSetm(e1);
    5050    pNext(e1)=e2;
    51     e2->exp[pdDX(n)]=d-1;
     51    pSetExp(e2,pdDX(n),d-1);
    5252    t = nInit(d);
    5353    pSetCoeff(e2,t);
     
    5656  else if (d==1)
    5757  {
    58     e1->exp[pdX(n)]=x;
    59     e1->exp[pdDX(n)]=1;
     58    pSetExp(e1,pdX(n),x);
     59    pSetExp(e1,pdDX(n),1);
    6060    pSetm(e1);
    6161    pNext(e1)=e2;
    62     e2->exp[n]=x-1;
     62    pSetExp(e2,n,x-1);
    6363    t = nInit(x);
    6464    pSetCoeff(e2,t);
     
    7272    poly h=NULL;
    7373
    74     e1->exp[pdX(n)]=x;
    75     e1->exp[pdDX(n)]=d;
     74    pSetExp(e1,pdX(n),x);
     75    pSetExp(e1,pdDX(n),d);
    7676    pSetm(e1);
    7777    for (j=1;j<=min(x,d);j++)
     
    8282        p *= (d-k);
    8383      }
    84       e2->exp[pdX(n)]=x-j;
    85       e2->exp[pdDX(n)]=d-j;
     84      pSetExp(e2,pdX(n),x-j);
     85      pSetExp(e2,pdDX(n),d-j);
    8686      pSetm(e2);
    8787      tp=0;
     
    114114  short c; /* the component number of the result*/
    115115
    116   if(c=pGetComp(a))
     116  if((c=pGetComp(a))!=0)
    117117  {
    118118#ifdef TEST
    119     if (pGetComp(b))
     119    if (pGetComp(b)!=0)
    120120    {
    121121      Werror("mult vector * vector");
     
    127127    c=pGetComp(b);
    128128
    129   pdDFlag(resl)=1;
    130   pdDFlag(resr)=1;
     129  pdSetDFlag(resl,1);
     130  pdSetDFlag(resr,1);
    131131  pSetCoeff(resl,nCopy(pGetCoeff(a)));
    132132  // put all x from a to the left result resl,
     
    134134  for (i=1;i<=pdN;i++)
    135135  {
    136     resl->exp[pdX(i)]=a->exp[pdX(i)];
    137     resr->exp[pdDX(i)]=b->exp[pdDX(i)];
     136    pSetExp(resl,pdX(i),pGetExp(a,pdX(i)));
     137    pSetExp(resr,pdDX(i),pGetExp(b,pdDX(i)));
    138138  }
    139139  // put all commutative vars y to the right result resr
    140140  for (i=1;i<=pdK;i++)
    141141  {
    142     resr->exp[pdY(i)]=a->exp[pdY(i)]+b->exp[pdY(i)];
     142    pSetExp(resr,pdY(i),pGetExp(a,pdY(i))+pGetExp(b,pdY(i)));
    143143  }
    144144  // set the component number
     
    147147  {
    148148    if ((a->exp[pdDX(i)] !=0) && (b->exp[pdX(i)] !=0))
     149    if ((pGetExp(a,pdDX(i)) !=0) && (pGetExp(b,pdX(i)) !=0))
    149150    {
    150151      if (multiply!=NULL)
    151152      {
    152         multiply=pMult(multiply,comm(i,a->exp[pdDX(i)],b->exp[pdX(i)]));
     153        multiply=pMult(multiply,comm(i,pGetExp(a,pdDX(i)),pGetExp(b,pdX(i))));
    153154      }
    154155      else
    155156      {
    156         multiply=comm(i,a->exp[pdDX(i)],b->exp[pdX(i)]);
     157        multiply=comm(i,pGetExp(a,pdDX(i)),pGetExp(b,pdX(i)));
    157158      }
    158159    }
    159160    else
    160161    {
    161       resl->exp[pdX(i)] += b->exp[pdX(i)];
    162       resr->exp[pdDX(i)] += a->exp[pdDX(i)];
     162      pSetExp(resl,pdX(i),pGetExp(resl,pdX(i))+pGetExp(b,pdX(i)));
     163      pSetExp(resr,pdDX(i),pGetExp(resr,pdDX(i))+pGetExp(a,pdDX(i)));
    163164    }
    164165  }
     
    174175    // now resl has only powers of x(i) and y(i), resr has only powers of d(i):
    175176    for (i=1;i<=pdN;i++)
    176       resl->exp[pdDX(i)]=resr->exp[pdDX(i)];
     177    {
     178      pSetExp(resl,pdDX(i),pGetExp(resr,pdDX(i)));
     179    }
    177180    pSetm(resl);
    178181    pFree1(resr);
     
    190193  short c; /* the component number of the result*/
    191194
    192   if(c=pGetComp(a))
     195  if((c=pGetComp(a))!=0)
    193196  {
    194197#ifdef TEST
    195     if (pGetComp(b))
     198    if (pGetComp(b)!=0)
    196199    {
    197200      Werror("mult vector * vector");
     
    206209  for (i=1;i<=pdN;i++)
    207210  {
    208     if ((a->exp[pdDX(i)] > b->exp[pdX(i)])
    209     && (b->exp[pdIX(i)]==0))
     211    if ((pGetExp(a,pdDX(i)) > pGetExp(b,pdX(i)))
     212    && (pGetExp(b,pdIX(i))==0))
    210213      return NULL;
    211214  }
    212215  poly resl=pOne();
    213   pdDFlag(resl)=0;
     216  pdSetDFlag(resl,0);
    214217  pSetCoeff(resl,nCopy(pGetCoeff(a)));
    215218  // put all x from a to the left result resl
    216219  for (i=1;i<=pdN;i++)
    217220  {
    218     resl->exp[pdX(i)]=a->exp[pdX(i)];
     221    pSetExp(resl,pdX(i),pGetExp(a,pdX(i)));
    219222  }
    220223  // put all commutative vars y to the left result resl
    221224  for (i=1;i<=pdK;i++)
    222225  {
    223     resl->exp[pdY(i)]=a->exp[pdY(i)]+b->exp[pdY(i)];
     226    pSetExp(resl,pdY(i),pGetExp(a,pdY(i))+pGetExp(b,pdY(i)));
    224227  }
    225228  // set the component number
     
    229232  for (i=1;i<=pdN;i++)
    230233  {
    231     if (((p=a->exp[pdDX(i)]) !=0) && ((q=b->exp[pdX(i)]) !=0))
     234    if (((p=pGetExp(a,pdDX(i))) !=0) && ((q=pGetExp(b,pdX(i))) !=0))
    232235    {
    233236      // d^p(x^q): q*(q-1)*...*(q-p+1)* x^(q-p)
    234       resl->exp[pdX(i)]+=q-p;
     237      pSetExp(resl,pdX(i),pGetExp(resl,pdX(i))+q-p);
    235238      n=nInit(q);
    236239      q--;p--;
     
    250253    }
    251254    else
    252     if (((p=a->exp[pdDX(i)]) !=0) && ((q=b->exp[pdIX(i)]) !=0))
     255    if (((p=pGetExp(a,pdDX(i))) !=0) && ((q=pGetExp(b,pdIX(i))) !=0))
    253256    {
    254257      // d^p(x^(-q)): (-1)^p*q*(q+1)*...*(q+p-1)* x^(-(q+p))
    255       resl->exp[pdIX(i)]+=q+p;
     258      pSetExp(resl,pdIX(i),pGetExp(resl,pdIX(i))+q+p);
    256259      if (p & 1) n=nInit(-q);
    257260      else       n=nInit(q);
     
    273276    else
    274277    {
    275       resl->exp[pdX(i)]+=b->exp[pdX(i)];
    276       resl->exp[pdIX(i)]+=b->exp[pdIX(i)];
     278      pSetExp(resl,pdX(i),pGetExp(resl,pdX(i))+pGetExp(b,pdX(i)));
     279      pSetExp(resl,pdIX(i),pGetExp(resl,pdIX(i))+pGetExp(b,pdIX(i)));
    277280    }
    278281  }
    279282  for(i=1;i<=pdN;i++)
    280283  {
    281     if (resl->exp[pdX(i)]>=resl->exp[pdIX(i)])
    282     {
    283       resl->exp[pdX(i)]-=resl->exp[pdIX(i)];
    284       resl->exp[pdIX(i)]=0;
     284    if (pGetExp(resl,pdX(i))>=pGetExp(resl,pdIX(i)))
     285    {
     286      pSetExp(resl,pdX(i),pGetExp(resl,pdX(i))-pGetExp(resl,pdIX(i)));
     287      pSetExp(resl,pdIX(i),0);
    285288    }
    286289    else
    287290    {
    288       resl->exp[pdIX(i)]-=resl->exp[pdX(i)];
    289       resl->exp[pdX(i)]=0;
     291      pSetExp(resl,pdIX(i),pGetExp(resl,pdIX(i))-pGetExp(resl,pdX(i)));
     292      pSetExp(resl,pdX(i),0);
    290293    }
    291294  }
     
    303306  short c; /* the component number of the result*/
    304307
    305   if(c=pGetComp(a))
     308  if((c=pGetComp(a))!=0)
    306309  {
    307310#ifdef TEST
    308     if (pGetComp(b))
     311    if (pGetComp(b)!=0)
    309312    {
    310313      Werror("mult vector * vector");
     
    318321  poly resl=pOne();
    319322  int t;
    320   pdDFlag(resl)=0;
     323  pdSetDFlag(resl,0);
    321324  pSetCoeff(resl,nCopy(pGetCoeff(a)));
    322325  for (i=1;i<=pdN;i++)
    323326  {
    324     t=a->exp[pdX(i)]+b->exp[pdX(i)]-a->exp[pdIX(i)]-b->exp[pdIX(i)];
    325     if (t>=0)  resl->exp[pdX(i)]=t;
    326     else       resl->exp[pdIX(i)]=-t;
     327    t=pGetExp(a,pdX(i))+pGetExp(b,pdX(i))-pGetExp(a,pdIX(i))-pGetExp(b,pdIX(i));
     328    if (t>=0)  pSetExp(resl,pdX(i),t);
     329    else       pSetExp(resl,pdIX(i),-t);
    327330  }
    328331  // put all commutative vars y to the result resl
    329332  for (i=1;i<=pdK;i++)
    330333  {
    331     resl->exp[pdY(i)]=a->exp[pdY(i)]+b->exp[pdY(i)];
     334    pSetExp(resl,pdY(i),pGetExp(a,pdY(i))+pGetExp(b,pdY(i)));
    332335  }
    333336  // set the component number
     
    544547      q=pOne();
    545548      pSetExp(q,pdDX(an),pGetExp(p,pdX(an))+1);
    546       pdDFlag(q)=1;
     549      pdSetDFlag(q,1);
    547550      pSetm(q);
    548551      //Print("1:  q ");wrp(q); Print("\n");
     
    570573      pSetExp(q,pdX(an),pGetExp(p,pdIX(an)));
    571574      pSetExp(dif,pdDX(an),1);
    572       pdDFlag(q)=1;
    573       pdDFlag(dif)=1;
     575      pdSetDFlag(q,1);
     576      pdSetDFlag(dif,1);
    574577      pSetm(q);
    575578      //Print("2: q ");wrp(q); Print("\n");
     
    604607  for (i=2*pdN; i>=0; i--)
    605608  {
    606      m->exp[i] = min(a->exp[i],b->exp[i]);
     609     pSetExp(m,i, min(pGetExp(a,i),pGetExp(b,i)));
    607610  }
    608611  for (i=pdY(1); i<=pdK; i++)
    609612  {
    610      m->exp[i] = max(a->exp[i],b->exp[i]);
     613     pSetExp(m,i, max(pGetExp(a,i),pGetExp(b,i)));
    611614  }
    612615}
Note: See TracChangeset for help on using the changeset viewer.