Changeset 41b473 in git for Singular/polys.cc


Ignore:
Timestamp:
Apr 23, 1998, 8:17:40 PM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
356dc3d199dbfae000f47b6c6d67ce4cffcb5771
Parents:
1d202e7f25871522d0ff3683f371e598b0a40eed
Message:
* hannes: fixed bug in rKill of Q-rings (polys.cc, ring.cc)


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

Legend:

Unmodified
Added
Removed
  • Singular/polys.cc

    r1d202e r41b473  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys.cc,v 1.22 1998-04-08 16:04:31 Singular Exp $ */
     4/* $Id: polys.cc,v 1.23 1998-04-23 18:17:39 Singular Exp $ */
    55
    66/*
     
    3434pCompProc pComp0;
    3535
    36 int pVariables;     // number of variables 
     36int pVariables;     // number of variables
    3737int pVariablesW;    // number of words of pVariables exponents
    3838int pVariables1W;   // number of words of (pVariables+1) exponents
     
    4141int pLexSgn;        // 1, for lex monom comps; -1 otherwise (exception: ls)
    4242int pVarOffset;     // controls the way exponents are stored in a vector
    43 int pVarLowIndex;   // lowest exponent index 
    44 int pVarHighIndex;  // highest exponent index 
     43int pVarLowIndex;   // lowest exponent index
     44int pVarHighIndex;  // highest exponent index
    4545int pVarCompIndex;  // Location of component in exponent vector
    4646
     
    116116{
    117117  p->Order = (((Order_t)pGetExp(p,1))<<(sizeof(Exponent_t)*8))
    118     + (Order_t)pGetExp(p,2); 
     118    + (Order_t)pGetExp(p,2);
    119119}
    120120
     
    157157}                                               \
    158158while(0)
    159  
     159
    160160#define Mreturn(d, multiplier)                      \
    161161{                                                   \
    162162  if (d > 0) return multiplier;                     \
    163163  return -multiplier;                               \
    164 }                                               
     164}
    165165
    166166static int pComp_otEXP_nwONE(poly p1, poly p2);
     
    177177static int pComp_otEXPCOMP_nwODD(poly p1, poly p2);
    178178
    179  
     179
    180180// comp_nwONE is used if pVariables1W == 1 and component is compatible
    181181// with ordering
    182 static int pComp_otEXP_nwONE(poly p1, poly p2) 
     182static int pComp_otEXP_nwONE(poly p1, poly p2)
    183183{
    184184  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    193193// comp_otEXPCOMP_nwONE :  pVariables1W == 1, priority is
    194194// given to exponents, component is incompatible with ordering
    195 static int pComp_otEXPCOMP_nwONE(poly p1, poly p2) 
     195static int pComp_otEXPCOMP_nwONE(poly p1, poly p2)
    196196{
    197197  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    206206// comp_otEXPCOMP_nwONE :  pVariables1W == 1, priority is given to component,
    207207// component is incompatible with ordering
    208 static int pComp_otCOMPEXP_nwONE(poly p1, poly p2) 
     208static int pComp_otCOMPEXP_nwONE(poly p1, poly p2)
    209209{
    210210  register long d = pGetComp(p2) - pGetComp(p1);
     
    213213  if (d) Mreturn(d, pOrdSgn);
    214214  _pMonComp_otEXP_nwONE(p1, p2, d, goto NotEqual , return 0);
    215  
     215
    216216  NotEqual:
    217217  Mreturn(d, pLexSgn);
     
    219219
    220220// comp_nwTWO :  pVariables1W == 2 and component is compatible with ordering
    221 static int pComp_otEXP_nwTWO(poly p1, poly p2) 
     221static int pComp_otEXP_nwTWO(poly p1, poly p2)
    222222{
    223223  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    232232// comp_otEXPCOMP_nwTWO :  pVariables1W == 2, priority is given to exponents,
    233233// component is incompatible with ordering
    234 static int pComp_otEXPCOMP_nwTWO(poly p1, poly p2) 
     234static int pComp_otEXPCOMP_nwTWO(poly p1, poly p2)
    235235{
    236236  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    238238  if (d) Mreturn(d, pOrdSgn);
    239239  _pMonComp_otEXPCOMP_nwTWO(p1, p2, d, goto NotEqual, return 0);
    240  
     240
    241241  NotEqual:
    242242  Mreturn(d, pLexSgn);
     
    245245// comp_otEXPCOMP_nwTWO :  pVariables1W == 2, priority is given to component,
    246246// component is incompatible with ordering
    247 static int pComp_otCOMPEXP_nwTWO(poly p1, poly p2) 
     247static int pComp_otCOMPEXP_nwTWO(poly p1, poly p2)
    248248{
    249249  register long d = pGetComp(p2) - pGetComp(p1);
     
    252252  if (d) Mreturn(d, pOrdSgn);
    253253  _pMonComp_otEXP_nwTWO(p1, p2, d, goto NotEqual , return 0);
    254  
     254
    255255  NotEqual:
    256256  Mreturn(d, pLexSgn);
     
    259259// comp_nwEVEN :  pVariables1W == 2*i and component is compatible
    260260// with ordering
    261 static int pComp_otEXP_nwEVEN(poly p1, poly p2) 
     261static int pComp_otEXP_nwEVEN(poly p1, poly p2)
    262262{
    263263  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    272272// comp_otEXPCOMP_nwEVEN : pVariables1W == 2*i, priority is given to exponents,
    273273// component is incompatible with ordering
    274 static int pComp_otEXPCOMP_nwEVEN(poly p1, poly p2) 
     274static int pComp_otEXPCOMP_nwEVEN(poly p1, poly p2)
    275275{
    276276  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    285285// comp_otEXPCOMP_nwEVEN : pVariables1W == 2*i, priority is given to component,
    286286// component is incompatible with ordering
    287 static int pComp_otCOMPEXP_nwEVEN(poly p1, poly p2) 
     287static int pComp_otCOMPEXP_nwEVEN(poly p1, poly p2)
    288288{
    289289  register long d = pGetComp(p2) - pGetComp(p1);
     
    292292  if (d) Mreturn(d, pOrdSgn);
    293293  _pMonComp_otEXP_nwEVEN(p1, p2, pVariablesW, d, goto NotEqual, return 0);
    294  
     294
    295295  NotEqual:
    296296  Mreturn(d, pLexSgn);
     
    299299// comp_nwODD : pVariables1W == 2*i and component is compatible
    300300// with ordering
    301 static int pComp_otEXP_nwODD(poly p1, poly p2) 
     301static int pComp_otEXP_nwODD(poly p1, poly p2)
    302302{
    303303  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    312312// comp_otEXPCOMP_nwODD : pVariables1W == 2*i, priority is given to exponents,
    313313// component is incompatible with ordering
    314 static int pComp_otEXPCOMP_nwODD(poly p1, poly p2) 
     314static int pComp_otEXPCOMP_nwODD(poly p1, poly p2)
    315315{
    316316  register long d = pGetOrder(p1) - pGetOrder(p2);
    317   if (d) 
     317  if (d)
    318318  {
    319319    if (d > 0) return pOrdSgn;
    320320    return -pOrdSgn;
    321321  }
    322  
     322
    323323  _pMonComp_otEXPCOMP_nwODD(p1, p2, pVariables1W, d, goto NotEqual , return 0);
    324  
     324
    325325  NotEqual:
    326326  Mreturn(d, pLexSgn);
     
    329329// comp_otCOMPEXP_nwODD : pVariables1W == 2*i, priority is given to component,
    330330// component is incompatible with ordering
    331 static int pComp_otCOMPEXP_nwODD(poly p1, poly p2) 
     331static int pComp_otCOMPEXP_nwODD(poly p1, poly p2)
    332332{
    333333  register long d = pGetComp(p2) - pGetComp(p1);
     
    336336  if (d) Mreturn(d, pOrdSgn);
    337337  _pMonComp_otEXP_nwODD(p1, p2, pVariablesW, d, goto NotEqual, return 0);
    338  
     338
    339339  NotEqual:
    340340  Mreturn(d, pLexSgn);
     
    924924int pTotaldegree(poly p)
    925925{
    926   return pExpQuerSum(p); 
     926  return pExpQuerSum(p);
    927927}
    928928
     
    11271127        else
    11281128        {
    1129           // component is compatible with exponent vector 
     1129          // component is compatible with exponent vector
    11301130          if (pVariables1W == 1)        *p = pComp_otEXP_nwONE;
    11311131          else if (pVariables1W == 2)   *p = pComp_otEXP_nwTWO;
     
    11341134        }
    11351135        break;
    1136        
     1136
    11371137#ifdef PDEBUG
    11381138      case ringorder_lp:
     
    11551155        else
    11561156        {
    1157           // component is compatible with exponent vector 
     1157          // component is compatible with exponent vector
    11581158          if (pVariables1W == 1)        *p = pComp_otEXP_nwONE;
    11591159          else if (pVariables1W == 2)   *p = pComp_otEXP_nwTWO;
     
    11671167#endif
    11681168  }
    1169  
     1169
    11701170  if (o_r == ringorder_lp || o_r == ringorder_ls)
    11711171  {
     
    12021202          *p = pComp_otCOMPEXP_nwEVEN;
    12031203        break;
    1204        
     1204
    12051205#ifdef PDEBUG
    12061206      case ringorder_lp:
     
    13731373{
    13741374  int i;
    1375   pComponentOrder=1;
    1376   if (ppNoether!=NULL) pDelete(&ppNoether);
     1375  pVariables = r->N;
     1376  if (complete)
     1377  {
     1378    pComponentOrder=1;
     1379    if (ppNoether!=NULL) pDelete(&ppNoether);
    13771380#ifdef SRING
    1378   pSRING=FALSE;
    1379   pAltVars=r->N+1;
     1381    pSRING=FALSE;
     1382    pAltVars=r->N+1;
    13801383#endif
    1381   pVariables = r->N;
    1382 
    1383   // set the various size parameters and initialize memory
    1384   if ((((pVariables+1)*sizeof(Exponent_t)) % sizeof(void*)) == 0)
    1385     pVariables1W = (pVariables+1)*sizeof(Exponent_t) / sizeof(void*);
    1386   else
    1387     pVariables1W = ((pVariables+1)*sizeof(Exponent_t) / sizeof(void*)) + 1;
    1388 
    1389   if ((((pVariables)*sizeof(Exponent_t)) % sizeof(void*)) == 0)
    1390     pVariablesW = (pVariables)*sizeof(Exponent_t) / sizeof(void*);
    1391   else
    1392     pVariablesW = ((pVariables)*sizeof(Exponent_t) / sizeof(void*)) + 1;
     1384
     1385    // set the various size parameters and initialize memory
     1386    if ((((pVariables+1)*sizeof(Exponent_t)) % sizeof(void*)) == 0)
     1387      pVariables1W = (pVariables+1)*sizeof(Exponent_t) / sizeof(void*);
     1388    else
     1389      pVariables1W = ((pVariables+1)*sizeof(Exponent_t) / sizeof(void*)) + 1;
     1390
     1391    if ((((pVariables)*sizeof(Exponent_t)) % sizeof(void*)) == 0)
     1392      pVariablesW = (pVariables)*sizeof(Exponent_t) / sizeof(void*);
     1393    else
     1394      pVariablesW = ((pVariables)*sizeof(Exponent_t) / sizeof(void*)) + 1;
     1395  }
    13931396
    13941397  pMonomSize = POLYSIZE + (pVariables + 1) * sizeof(Exponent_t);
    1395   if ((pMonomSize % sizeof(void*)) == 0)
    1396   {
    1397     pMonomSizeW = pMonomSize/sizeof(void*);
    1398   }
    1399   else
    1400   {
    1401     pMonomSizeW = pMonomSize/sizeof(void*) + 1;
    1402     pMonomSize = pMonomSizeW*sizeof(void*);
    1403   }
    1404  
    1405   // Set default Var Indicies
    1406   pSetVarIndicies(pVariables);
    1407 
    1408   // Initialize memory management
     1398
     1399  // Initialize memory management
    14091400  mmSpecializeBlock(pMonomSize);
    1410  
    1411   pOrdSgn = r->OrdSgn;
    1412   pVectorOut=(r->order[0]==ringorder_c);
    1413   order=r->order;
    1414   block0=r->block0;
    1415   block1=r->block1;
    1416   firstwv=NULL;
    1417   polys_wv=r->wvhdl;
    1418   /*------- only one real block ----------------------*/
    1419   pLexOrder=FALSE;
    1420   pMixedOrder=FALSE;
    1421   pFDeg=pDeg;
    1422   if (pOrdSgn == 1) pLDeg = ldegb;
    1423   else              pLDeg = ldeg0;
    1424   /*======== ordering type is (_,c) =========================*/
    1425   if ((order[0]==ringorder_unspec)
    1426   ||(
    1427     ((order[1]==ringorder_c)||(order[1]==ringorder_C))
    1428     && (order[0]!=ringorder_M)
    1429     && (order[2]==0))
    1430   )
    1431   {
    1432     if ((order[0]!=ringorder_unspec)
    1433     && (order[1]==ringorder_C))
    1434       pComponentOrder=-1;
    1435     if (pOrdSgn == -1) pLDeg = ldeg0c;
    1436     SimpleChoose(order[0],order[1], &pComp0);
    1437     SetpSetm(order[0],0);
    1438   }
    1439   /*======== ordering type is (c,_) =========================*/
    1440   else if (((order[0]==ringorder_c)||(order[0]==ringorder_C))
    1441   && (order[1]!=ringorder_M)
    1442   &&  (order[2]==0))
    1443   {
    1444     /* pLDeg = ldeg0; is standard*/
    1445     if (order[0]==ringorder_C)
    1446       pComponentOrder=-1;
    1447     SimpleChooseC(order[1], &pComp0);
    1448     SetpSetm(order[1],1);
    1449   }
    1450   /*------- more than one block ----------------------*/
    1451   else
    1452   {
    1453     //pLexOrder=TRUE;
    1454     pVectorOut=order[0]==ringorder_c;
    1455     if ((pVectorOut)||(order[0]==ringorder_C))
    1456     {
    1457       if(block1[1]!=pVariables) pLexOrder=TRUE;
    1458     } 
     1401
     1402  if (complete)
     1403  {
     1404    if ((pMonomSize % sizeof(void*)) == 0)
     1405    {
     1406      pMonomSizeW = pMonomSize/sizeof(void*);
     1407    }
    14591408    else
    14601409    {
    1461       if(block1[0]!=pVariables) pLexOrder=TRUE;
    1462     }
    1463     /*the number of orderings:*/
    1464     i = 0;
    1465     while (order[++i] != 0);
    1466     do
    1467     {
    1468       i--;
    1469       HighSet(i, order[i]);/*sets also pMixedOrder to TRUE, if...*/
    1470       SetpSetm(order[i],i);
    1471     }
    1472     while (i != 0);
    1473 
    1474     pComp0 = BlockComp;
    1475     if ((order[0]!=ringorder_c)&&(order[0]!=ringorder_C))
    1476     {
    1477       pLDeg = ldeg1c;
    1478     }
     1410      pMonomSizeW = pMonomSize/sizeof(void*) + 1;
     1411      pMonomSize = pMonomSizeW*sizeof(void*);
     1412    }
     1413
     1414    // Set default Var Indicies
     1415    pSetVarIndicies(pVariables);
     1416
     1417    pOrdSgn = r->OrdSgn;
     1418    pVectorOut=(r->order[0]==ringorder_c);
     1419    order=r->order;
     1420    block0=r->block0;
     1421    block1=r->block1;
     1422    firstwv=NULL;
     1423    polys_wv=r->wvhdl;
     1424    /*------- only one real block ----------------------*/
     1425    pLexOrder=FALSE;
     1426    pMixedOrder=FALSE;
     1427    pFDeg=pDeg;
     1428    if (pOrdSgn == 1) pLDeg = ldegb;
     1429    else              pLDeg = ldeg0;
     1430    /*======== ordering type is (_,c) =========================*/
     1431    if ((order[0]==ringorder_unspec)
     1432    ||(
     1433      ((order[1]==ringorder_c)||(order[1]==ringorder_C))
     1434      && (order[0]!=ringorder_M)
     1435      && (order[2]==0))
     1436    )
     1437    {
     1438      if ((order[0]!=ringorder_unspec)
     1439      && (order[1]==ringorder_C))
     1440        pComponentOrder=-1;
     1441      if (pOrdSgn == -1) pLDeg = ldeg0c;
     1442      SimpleChoose(order[0],order[1], &pComp0);
     1443      SetpSetm(order[0],0);
     1444    }
     1445    /*======== ordering type is (c,_) =========================*/
     1446    else if (((order[0]==ringorder_c)||(order[0]==ringorder_C))
     1447    && (order[1]!=ringorder_M)
     1448    &&  (order[2]==0))
     1449    {
     1450      /* pLDeg = ldeg0; is standard*/
     1451      if (order[0]==ringorder_C)
     1452        pComponentOrder=-1;
     1453      SimpleChooseC(order[1], &pComp0);
     1454      SetpSetm(order[1],1);
     1455    }
     1456    /*------- more than one block ----------------------*/
    14791457    else
    14801458    {
    1481       pLDeg = ldeg1;
    1482     }
    1483     pFDeg = pWTotaldegree; // may be improved: pTotaldegree for lp/dp/ls/.. blocks
    1484   }
    1485   if ((pLexOrder) || (pOrdSgn==-1))
    1486   {
    1487     test &= ~Sy_bit(OPT_REDTAIL); /* noredTail */
     1459      //pLexOrder=TRUE;
     1460      pVectorOut=order[0]==ringorder_c;
     1461      if ((pVectorOut)||(order[0]==ringorder_C))
     1462      {
     1463        if(block1[1]!=pVariables) pLexOrder=TRUE;
     1464      }
     1465      else
     1466      {
     1467        if(block1[0]!=pVariables) pLexOrder=TRUE;
     1468      }
     1469      /*the number of orderings:*/
     1470      i = 0;
     1471      while (order[++i] != 0);
     1472      do
     1473      {
     1474        i--;
     1475        HighSet(i, order[i]);/*sets also pMixedOrder to TRUE, if...*/
     1476        SetpSetm(order[i],i);
     1477      }
     1478      while (i != 0);
     1479
     1480      pComp0 = BlockComp;
     1481      if ((order[0]!=ringorder_c)&&(order[0]!=ringorder_C))
     1482      {
     1483        pLDeg = ldeg1c;
     1484      }
     1485      else
     1486      {
     1487        pLDeg = ldeg1;
     1488      }
     1489      // may be improved: pTotaldegree for lp/dp/ls/.. blocks
     1490      pFDeg = pWTotaldegree;
     1491    }
     1492    if ((pLexOrder) || (pOrdSgn==-1))
     1493    {
     1494      test &= ~Sy_bit(OPT_REDTAIL); /* noredTail */
     1495    }
    14881496  }
    14891497}
Note: See TracChangeset for help on using the changeset viewer.