Changeset 18255d in git


Ignore:
Timestamp:
Mar 19, 1998, 5:05:53 PM (25 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
737b2b4e3dd7efb3603cab701c4146ea17e9805e
Parents:
7f1b912b1613387b9ef8e0f2a053a2c335b9b5da
Message:
1998-03-18  Olaf Bachmann  <obachman@mathematik.uni-kl.de>

	* Cleaned up COMP_FAST and related #defines almost everywhere


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

Legend:

Unmodified
Added
Removed
  • Singular/ChangeLog

    r7f1b91 r18255d  
    111998-03-18  Olaf Bachmann  <obachman@mathematik.uni-kl.de>
    22
    3         * polys-impl.h: Cleaned up COMP_FAST and related #defines
     3        * Makefile.in: added Singularb target for bprof
     4
     5        * polys-impl.h, polys-comp.h: Cleaned up COMP_FAST and related
     6        #defines
    47
    581998-03-16  Olaf Bachmann  <obachman@mathematik.uni-kl.de>
  • Singular/ipid.h

    r7f1b91 r18255d  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: ipid.h,v 1.8 1998-01-16 14:29:53 krueger Exp $ */
     6/* $Id: ipid.h,v 1.9 1998-03-19 16:05:43 obachman Exp $ */
    77/*
    88* ABSTRACT: identfier handling
     
    3737
    3838  // what follows below here should be set by rComplete, _only_
    39 #ifdef COMP_FAST
    4039  short     VarOffset; /* controls indexing of exponents */
    41   short     CompIndex; /* index of component in exponent vector */
    42 #endif   
    4340
    4441#ifdef RDEBUG
  • Singular/kstd1.cc

    r7f1b91 r18255d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd1.cc,v 1.15 1998-03-16 14:56:31 obachman Exp $ */
     4/* $Id: kstd1.cc,v 1.16 1998-03-19 16:05:44 obachman Exp $ */
    55/*
    66* ABSTRACT:
     
    16431643  initBuchMoraPos(strat);
    16441644  initMora(F,strat);
    1645 #ifdef COMP_FAST
    1646   strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    1647 #endif 
     1645  strat->spSpolyLoop = spGetSpolyLoop(currRing,
     1646                                      MAX(strat->ak,pMaxComp(q)),
     1647                                      strat->syzComp, FALSE);
    16481648  strat->enterS = enterSMoraNF;
    16491649  /*- set T -*/
     
    17381738  strat->enterS = enterSMoraNF;
    17391739  /*- set T -*/
    1740 #ifdef COMP_FAST
    1741   strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    1742 #endif 
     1740  strat->spSpolyLoop = spGetSpolyLoop(currRing,
     1741                                      MAX(strat->ak,idRankFreeModule(q)),
     1742                                      strat->syzComp, FALSE);
    17431743  strat->tl = -1;
    17441744  strat->tmax = setmax;
     
    18761876  strat->homog=h;
    18771877  spSet(currRing);
    1878 #ifdef COMP_FAST
    18791878  strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    1880 #endif 
    18811879  if (pOrdSgn==-1)
    18821880  {
     
    20772075  strat->homog=h;
    20782076  spSet(currRing);
    2079 #ifdef COMP_FAST
    20802077  strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    2081 #endif
    20822078  if (pOrdSgn==-1)
    20832079  {
     
    21532149  strat->syzComp = syzComp;
    21542150  spSet(currRing);
    2155 #ifdef COMP_FAST
    2156   strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    2157 #endif 
    21582151  if (pOrdSgn==-1)
    21592152    p=kNF1(F,Q,p,strat,lazyReduce);
     
    21742167  kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy));
    21752168  strat->syzComp = syzComp;
    2176 #ifdef COMP_FAST
    2177   strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    2178 #endif 
    21792169  if (pOrdSgn==-1)
    21802170    res=kNF1(F,Q,p,strat,lazyReduce);
     
    22172207  strat->tmax        = setmax;
    22182208  strat->T           = initT();
    2219 #ifdef COMP_FAST
    22202209  strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    2221 #endif 
    22222210  if (pOrdSgn == -1)   strat->honey = TRUE;
    22232211  initS(F,Q,strat);
  • Singular/kstd2.cc

    r7f1b91 r18255d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.12 1998-03-16 14:56:32 obachman Exp $ */
     4/* $Id: kstd2.cc,v 1.13 1998-03-19 16:05:46 obachman Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    15471547  /*- set S -*/
    15481548  strat->sl = -1;
    1549 #ifdef COMP_FAST
    1550   strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    1551 #endif
     1549  // strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
     1550  strat->spSpolyLoop = spGetSpolyLoop(currRing, MAX(strat->ak, pMaxComp(q)),
     1551                                      strat->syzComp, FALSE);
    15521552  /*- init local data struct.---------------------------------------- -*/
    15531553  /*Shdl=*/initS(F,Q,strat);
     
    15921592  /*- set S -*/
    15931593  strat->sl = -1;
    1594 #ifdef COMP_FAST
    1595   strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    1596 #endif
     1594  strat->spSpolyLoop =  spGetSpolyLoop(currRing,
     1595                                       MAX(strat->ak, idRankFreeModule(q)),
     1596                                       strat->syzComp, FALSE);
    15971597  /*- init local data struct.---------------------------------------- -*/
    15981598  /*Shdl=*/initS(F,Q,strat);
     
    16841684  strat->homog=h;
    16851685  spSet(currRing);
    1686 #ifdef COMP_FAST
    16871686  strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);
    1688 #endif
    16891687  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
    16901688  initBuchMoraPos(strat);
  • Singular/kutil.cc

    r7f1b91 r18255d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kutil.cc,v 1.12 1998-03-16 14:56:34 obachman Exp $ */
     4/* $Id: kutil.cc,v 1.13 1998-03-19 16:05:47 obachman Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for std
     
    38083808}
    38093809
    3810 rOrderType_t spGetOrderType(ring r, kStrategy strat)
    3811 {
    3812   if (strat->syzComp > 0)
     3810rOrderType_t spGetOrderType(ring r, int modrank, int syzcomp)
     3811{
     3812  if (syzcomp > 0)
    38133813    return rOrderType_Syz;
    38143814  else
     
    38173817 
    38183818    if ((rot == rOrderType_CompExp || rot == rOrderType_ExpComp) &&
    3819         (strat->ak == 0))
     3819        (modrank == 0))
    38203820      return rOrderType_Exp;
    38213821    else
  • Singular/kutil.h

    r7f1b91 r18255d  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kutil.h,v 1.5 1998-03-16 14:56:35 obachman Exp $ */
     6/* $Id: kutil.h,v 1.6 1998-03-19 16:05:48 obachman Exp $ */
    77/*
    88* ABSTRACT: kernel: utils for std
     
    173173BOOLEAN homogTest(polyset F, int Fmax);
    174174BOOLEAN newHEdge(polyset S, int ak,kStrategy strat);
    175 rOrderType_t spGetOrderType(ring r, kStrategy strat);
     175
     176rOrderType_t spGetOrderType(ring r, int modrank, int syzcomp);
     177inline rOrderType_t spGetOrderType(ring r, kStrategy strat)
     178{
     179  return spGetOrderType(r, strat->ak, strat->syzComp);
     180}
     181
     182inline int MAX(int a, int b)
     183{
     184  if (a > b) return a;
     185  else return b;
     186}
     187
    176188
    177189inline TSet initT () { return (TSet)Alloc0(setmax*sizeof(TObject)); }
  • Singular/polys-impl.cc

    r7f1b91 r18255d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys-impl.cc,v 1.10 1998-03-18 14:28:48 obachman Exp $ */
     4/* $Id: polys-impl.cc,v 1.11 1998-03-19 16:05:49 obachman Exp $ */
    55
    66/***************************************************************
     
    2929#include "ipid.h"
    3030
     31#ifdef COMP_FAST
    3132/***************************************************************
    3233 *
    33  * definition of global variables
     34 * Low - level routines for which deal with var indicies
    3435 *
    3536 ***************************************************************/
    36 
    37 int pVariables;
    38 int pMonomSize;
    39 int pMonomSizeW;
    40 
    41 #ifdef COMP_FAST
    42 int pVariables1W;
    43 int pVariablesW;
    44 int pVarOffset;
    45 int pCompIndex;
    46 int pVarLowIndex;
    47 int pVarHighIndex;
    48 #endif
    49 int pLexSgn;
    50 
    51 /***************************************************************
    52  *
    53  * Low - level routines for which deal with var indicies
    54  *
    55  ***************************************************************/
    56 #ifdef COMP_FAST
    5737// gets var indicies w.r.t. the ring r
    5838void pGetVarIndicies(ring r, int &VarOffset,
     
    10585
    10686
    107 // assumes that pVarOffset != src_r->VarOffset
    10887inline void RingCopy2ExpV(poly dest, poly src, ring src_r)
    10988{
    110 #if 0
    111   if (_pHasReverseExp)
    112   {
    113 #ifdef WORDS_BIGENDIAN
    114     for (int i=0, offset = src_r->VarOffset - 1; i<pVariables; i++)
    115       dest->exp[i] = src->exp[offset - i];
    116 #else
    117 #endif
    118   }
    119 
    120 #endif
    12189  for (int i=pVariables; i; i--)
    12290    pSetExp(dest, i, pRingGetExp(src_r, src, i));
     
    144112  if (r->VarOffset == pVarOffset)
    145113  {
    146     memcpy(a,p,pMonomSize);
     114    pCopy2(a,p);
    147115    a->coef=nCopy(p->coef);
    148116    pSetm(a);
     
    157125        a = pNext(a) = pNew();
    158126#endif
    159         memcpy(a,p,pMonomSize);
     127        pCopy2(a,p);
    160128        a->coef=nCopy(p->coef);
    161129        pSetm(a);
     
    594562  pCopy2(ptemp, p1);
    595563
    596   _pMonAddFast(p1, p2);
     564  __pMonAddFast(p1, p2);
    597565
    598566  for (int i=1; i<=pVariables; i++)
  • Singular/polys.cc

    r7f1b91 r18255d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys.cc,v 1.17 1998-03-18 14:28:50 obachman Exp $ */
     4/* $Id: polys.cc,v 1.18 1998-03-19 16:05:50 obachman Exp $ */
    55
    66/*
     
    2121#include "binom.h"
    2222#include "ipid.h"
    23 
    24 #ifdef COMP_FAST
    2523#include "polys-comp.h"
    26 #endif
    2724
    2825/* ----------- global variables, set by pChangeRing --------------------- */
     
    3431pFDegProc pFDeg;
    3532/* the monomial ordering of the head monomials a and b */
     33/* returns -1 if a comes before b, 0 if a=b, 1 otherwise */
    3634pCompProc pComp0;
    37 /* returns -1 if a comes before b, 0 if a=b, 1 otherwise */
    38 
    39 /* the number of variables             */
     35
     36int pVariables;     // number of variables
     37int pVariablesW;    // number of words of pVariables exponents
     38int pVariables1W;   // number of words of (pVariables+1) exponents
     39int pMonomSize;     // size of monom (in bytes)
     40int pMonomSizeW;    // size of monom (in words)
     41int pLexSgn;        // 1, for lex monom comps; -1 otherwise (exception: ls)
     42int pVarOffset;     // controls the way exponents are stored in a vector
     43int pVarLowIndex;   // lowest exponent index
     44int pVarHighIndex;  // highest exponent index
     45
    4046/* 1 for polynomial ring, -1 otherwise */
    4147int     pOrdSgn;
     
    4753/* TRUE if the monomial ordering has polynomial and power series blocks */
    4854BOOLEAN pMixedOrder;
    49 
    50 #if defined(TEST_MAC_ORDER) || defined(COMP_FAST)
     55/* 1 for c ordering, -1 otherwise (i.e. for C ordering) */
    5156int  pComponentOrder;
    52 #else
    53 static int  pComponentOrder;
    54 #endif
    5557
    5658#ifdef DRING
     
    7678/*is the basic comparing procedure during a computation of syzygies*/
    7779static pCompProc pCompOld;
    78 /*for grouping module indecees during computations*/
    79 #ifndef COMP_FAST
    80 static int maxBound = 0;
    81 #else
    82 int maxBound = 0;
    83 #endif
     80/*for grouping module indicies during computations*/
     81int pMaxBound = 0;
    8482
    8583/*contains the headterms for the Schreyer orderings*/
     
    126124{
    127125  p->Order = pExpQuerSum1(p, firstBlockEnds);
    128 #ifdef COMP_DEBUG 
    129     int i, j = pGetExp(p,1);
    130 
    131   for (i = firstBlockEnds; i > 1; i--) j += pGetExp(p,i);
    132   if (j != p->Order)
    133   {
    134     Print("Error in setdeg1");
    135     pExpQuerSum1(p, firstBlockEnds);
    136   }
    137 #endif 
    138126}
    139127
     
    155143
    156144/*-------- IMPLEMENTATION OF MONOMIAL COMPARISONS ---------------------*/
    157 
    158 
    159 /***************************************************************
    160  *************************************************************** 
    161  *
    162  * MONOMIAL COMPARIONS:
    163  * They are influenced by the following macros:
    164  * COMP_TRADITIONAL -- (un)set in polys-impl.h
    165      Keeps the traditional comparison routines
    166      defined -- needed as long as their might be comparisons with
    167      negativ components.
    168      All the traditional routines are prefixed by t_
    169      
    170  * COMP_FAST -- (un)set in polys-impl.h
    171      Implements monomial comparisons using the fast
    172      techniques. Undefine in case there are problems. All the fast
    173      routines are prefixed by f_
    174      
    175  * COMP_STATISTIC -- (un)set in polys-impl.h
    176      Provides several routines for accumulating statistics on monomial
    177      comparisons
    178      
    179  * COMP_DEBUG -- (un)set in polys-impl.h
    180      Turns on debugging of COMP_FAST by comparing the resutsl of fast
    181      comparison with traditional comparison
    182 
    183  *   
    184  *
    185  *************************************************************** 
    186  ***************************************************************/
    187 
    188 #ifdef COMP_DEBUG
    189 static int debug_comp(poly p1, poly p2);
    190 #endif // COMP_DEBUG
    191 
    192 #ifdef COMP_STATISTICS
    193 // Initializes, resets and outputs Comp statistics
    194 void InitCompStatistics(int nvars);
    195 void ResetCompStatistics();
    196 void OutputCompStatistics();
    197 unsigned long MonomCountTotal = 0;
    198 unsigned long MonomCountOrderS = 0;
    199 unsigned long MonomCountOrderG = 0;
    200 unsigned long* MonomCountExp = NULL;
    201 unsigned long MonomCountExpS = 0;
    202 unsigned long MonomCountExpG = 0;
    203 unsigned long MonomCountCompS = 0;
    204 unsigned long MonomCountCompG = 0;
    205 unsigned long MonomCountEqual = 0;
    206 #endif // COMP_STATISTICS
    207145
    208146
     
    219157while(0)
    220158 
    221 /***************************************************************
    222  *
    223  * FAST COMPARISONS
    224  *
    225  ***************************************************************/
    226 #ifdef COMP_FAST
    227 static pCompProc f_pComp0 = NULL;
    228 static int f_comp_otEXP_nwONE(poly p1, poly p2);
    229 static int f_comp_otCOMPEXP_nwONE(poly p1, poly p2);
    230 static int f_comp_otEXPCOMP_nwONE(poly p1, poly p2);
    231 static int f_comp_otEXP_nwTWO(poly p1, poly p2);
    232 static int f_comp_otCOMPEXP_nwTWO(poly p1, poly p2);
    233 static int f_comp_otEXPCOMP_nwTWO(poly p1, poly p2);
    234 static int f_comp_otEXP_nwEVEN(poly p1, poly p2);
    235 static int f_comp_otCOMPEXP_nwEVEN(poly p1, poly p2);
    236 static int f_comp_otEXPCOMP_nwEVEN(poly p1, poly p2);
    237 static int f_comp_otEXP_nwODD(poly p1, poly p2);
    238 static int f_comp_otCOMPEXP_nwODD(poly p1, poly p2);
    239 static int f_comp_otEXPCOMP_nwODD(poly p1, poly p2);
    240 
    241159#define Mreturn(d, multiplier)                      \
    242160{                                                   \
     
    244162  return -multiplier;                               \
    245163}                                               
     164
     165static int pComp_otEXP_nwONE(poly p1, poly p2);
     166static int pComp_otCOMPEXP_nwONE(poly p1, poly p2);
     167static int pComp_otEXPCOMP_nwONE(poly p1, poly p2);
     168static int pComp_otEXP_nwTWO(poly p1, poly p2);
     169static int pComp_otCOMPEXP_nwTWO(poly p1, poly p2);
     170static int pComp_otEXPCOMP_nwTWO(poly p1, poly p2);
     171static int pComp_otEXP_nwEVEN(poly p1, poly p2);
     172static int pComp_otCOMPEXP_nwEVEN(poly p1, poly p2);
     173static int pComp_otEXPCOMP_nwEVEN(poly p1, poly p2);
     174static int pComp_otEXP_nwODD(poly p1, poly p2);
     175static int pComp_otCOMPEXP_nwODD(poly p1, poly p2);
     176static int pComp_otEXPCOMP_nwODD(poly p1, poly p2);
     177
    246178 
    247 // comp_nwONE is used if pVariables1W == 1 and component is compatible with ordering
    248 static int f_comp_otEXP_nwONE(poly p1, poly p2) 
     179// comp_nwONE is used if pVariables1W == 1 and component is compatible
     180// with ordering
     181static int pComp_otEXP_nwONE(poly p1, poly p2) 
    249182{
    250183  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    257190}
    258191
    259 // comp_otEXPCOMP_nwONE is used if pVariables1W == 1, priority is given to exponents,
    260 // component is incompatible with ordering
    261 static int f_comp_otEXPCOMP_nwONE(poly p1, poly p2) 
     192// comp_otEXPCOMP_nwONE :  pVariables1W == 1, priority is
     193// given to exponents, component is incompatible with ordering
     194static int pComp_otEXPCOMP_nwONE(poly p1, poly p2) 
    262195{
    263196  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    270203}
    271204
    272 // comp_otEXPCOMP_nwONE is used if pVariables1W == 1, priority is given to component,
     205// comp_otEXPCOMP_nwONE : pVariables1W == 1, priority is given to component,
    273206// component is incompatible with ordering
    274 static int f_comp_otCOMPEXP_nwONE(poly p1, poly p2) 
     207static int pComp_otCOMPEXP_nwONE(poly p1, poly p2) 
    275208{
    276209  register long d = pGetComp(p2) - pGetComp(p1);
     
    284217}
    285218
    286 // comp_nwTWO is used if pVariables1W == 2 and component is compatible with ordering
    287 static int f_comp_otEXP_nwTWO(poly p1, poly p2) 
     219// comp_nwTWO : pVariables1W == 2 and component is compatible with ordering
     220static int pComp_otEXP_nwTWO(poly p1, poly p2) 
    288221{
    289222  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    296229}
    297230
    298 // comp_otEXPCOMP_nwTWO is used if pVariables1W == 2, priority is given to exponents,
     231// comp_otEXPCOMP_nwTWO : pVariables1W == 2, priority is given to exponents,
    299232// component is incompatible with ordering
    300 static int f_comp_otEXPCOMP_nwTWO(poly p1, poly p2) 
     233static int pComp_otEXPCOMP_nwTWO(poly p1, poly p2) 
    301234{
    302235  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    309242}
    310243
    311 // comp_otEXPCOMP_nwTWO is used if pVariables1W == 2, priority is given to component,
     244// comp_otEXPCOMP_nwTWO : pVariables1W == 2, priority is given to component,
    312245// component is incompatible with ordering
    313 static int f_comp_otCOMPEXP_nwTWO(poly p1, poly p2) 
     246static int pComp_otCOMPEXP_nwTWO(poly p1, poly p2) 
    314247{
    315248  register long d = pGetComp(p2) - pGetComp(p1);
     
    323256}
    324257
    325 // comp_nwEVEN is used if pVariables1W == 2*i and component is compatible
     258// comp_nwEVEN : pVariables1W == 2*i and component is compatible
    326259// with ordering
    327 static int f_comp_otEXP_nwEVEN(poly p1, poly p2) 
     260static int pComp_otEXP_nwEVEN(poly p1, poly p2) 
    328261{
    329262  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    336269}
    337270
    338 // comp_otEXPCOMP_nwEVEN is used if pVariables1W == 2*i, priority is given to exponents,
     271// comp_otEXPCOMP_nwEVEN : pVariables1W == 2*i, priority is given to exponents,
    339272// component is incompatible with ordering
    340 static int f_comp_otEXPCOMP_nwEVEN(poly p1, poly p2) 
     273static int pComp_otEXPCOMP_nwEVEN(poly p1, poly p2) 
    341274{
    342275  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    349282}
    350283
    351 // comp_otEXPCOMP_nwEVEN is used if pVariables1W == 2*i, priority is given to component,
     284// comp_otEXPCOMP_nwEVEN : pVariables1W == 2*i, priority is given to component,
    352285// component is incompatible with ordering
    353 static int f_comp_otCOMPEXP_nwEVEN(poly p1, poly p2) 
     286static int pComp_otCOMPEXP_nwEVEN(poly p1, poly p2) 
    354287{
    355288  register long d = pGetComp(p2) - pGetComp(p1);
     
    363296}
    364297
    365 // comp_nwODD is used if pVariables1W == 2*i and component is compatible
     298// comp_nwODD : pVariables1W == 2*i and component is compatible
    366299// with ordering
    367 static int f_comp_otEXP_nwODD(poly p1, poly p2) 
     300static int pComp_otEXP_nwODD(poly p1, poly p2) 
    368301{
    369302  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    376309}
    377310
    378 // comp_otEXPCOMP_nwODD is used if pVariables1W == 2*i, priority is given to exponents,
     311// comp_otEXPCOMP_nwODD : pVariables1W == 2*i, priority is given to exponents,
    379312// component is incompatible with ordering
    380 static int f_comp_otEXPCOMP_nwODD(poly p1, poly p2) 
     313static int pComp_otEXPCOMP_nwODD(poly p1, poly p2) 
    381314{
    382315  register long d = pGetOrder(p1) - pGetOrder(p2);
     
    393326}
    394327
    395 // comp_otCOMPEXP_nwODD is used if pVariables1W == 2*i, priority is given to component,
     328// comp_otCOMPEXP_nwODD : pVariables1W == 2*i, priority is given to component,
    396329// component is incompatible with ordering
    397 static int f_comp_otCOMPEXP_nwODD(poly p1, poly p2) 
     330static int pComp_otCOMPEXP_nwODD(poly p1, poly p2) 
    398331{
    399332  register long d = pGetComp(p2) - pGetComp(p1);
     
    406339  Mreturn(d, pLexSgn);
    407340}
    408 #endif // COMP_FAST
    409 
    410 /***************************************************************
    411  *
    412  * FAST COMPARISONS
    413  *
    414  ***************************************************************/
    415 #ifdef COMP_TRADITIONAL
    416 
    417 static int t_comp_otCOMPEXP_nwONE(poly p1, poly p2);
    418 static int t_comp_otEXPCOMP_nwONE(poly p1, poly p2);
    419 static int t_comp_lex_otCOMPEXP_i(poly p1, poly p2);
    420 static int t_comp_otCOMPEXP_lex_i(poly p1, poly p2);
    421 static int t_comp_revlex_otCOMPEXP_i(poly p1, poly p2);
    422 static int t_comp_otCOMPEXP_revlex_i(poly p1, poly p2);
    423 
    424 inline long LexComp(poly p1, poly p2)
    425 {
    426   long d, i;
    427   for (i=1; i<pVariables; i++)
    428   {
    429     d = pGetExpDiff(p1, p2, i);
    430     if (d) return d;
    431   }
    432   return pGetExpDiff(p1, p2, pVariables);
    433 }
    434 
    435 inline long RevLexComp(poly p1, poly p2)
    436 {
    437   long d, i;
    438   for (i=pVariables; i>1; i--)
    439   {
    440     d = pGetExpDiff(p1, p2, i);
    441     if (d) return d;
    442   }
    443   return pGetExpDiff(p1, p2, 1);
    444 }
    445 
    446 static int t_comp_otCOMPEXP_nwONE(poly p1, poly p2)
    447 {
    448   NonZeroR(pGetComp(p1) - pGetComp(p2),
    449            return -pComponentOrder, return pComponentOrder);
    450   NonZeroR(pGetOrder(p1) - pGetOrder(p2), return pOrdSgn, return -pOrdSgn);
    451   return 0;
    452 }
    453 
    454 static int t_comp_otEXPCOMP_nwONE(poly p1, poly p2)
    455 {
    456   NonZeroR(pGetOrder(p1) - pGetOrder(p2), return pOrdSgn, return -pOrdSgn);
    457   NonZeroR(pGetComp(p1) - pGetComp(p2),
    458            return -pComponentOrder, return pComponentOrder);
    459   return 0;
    460 }
    461 
    462 static int t_comp_lex_otCOMPEXP_i(poly p1, poly p2)
    463 {
    464   NonZeroR(pGetComp(p1) - pGetComp(p2),
    465            return -pComponentOrder, return pComponentOrder);
    466   NonZeroR(pGetOrder(p1) - pGetOrder(p2), return pOrdSgn, return -pOrdSgn);
    467   NonZeroR(LexComp(p1, p2), return pLexSgn, return -pLexSgn);
    468   return 0;
    469 }
    470 
    471 static int t_comp_otEXPCOMP_lex_i(poly p1, poly p2)
    472 {
    473   NonZeroR(pGetOrder(p1) - pGetOrder(p2), return pOrdSgn, return -pOrdSgn);
    474   NonZeroR(LexComp(p1, p2), return pLexSgn, return -pLexSgn);
    475   NonZeroR(pGetComp(p1) - pGetComp(p2),
    476            return -pComponentOrder, return pComponentOrder);
    477   return 0;
    478 }
    479 
    480 static int t_comp_revlex_otCOMPEXP_i(poly p1, poly p2)
    481 {
    482   NonZeroR(pGetComp(p1) - pGetComp(p2),
    483            return -pComponentOrder, return pComponentOrder);
    484   NonZeroR(pGetOrder(p1) - pGetOrder(p2), return pOrdSgn, return -pOrdSgn);
    485   NonZeroR(RevLexComp(p1, p2), return pLexSgn, return -pLexSgn);
    486   return 0;
    487 }
    488 
    489 static int t_comp_otEXPCOMP_revlex_i(poly p1, poly p2)
    490 {
    491   NonZeroR(pGetOrder(p1) - pGetOrder(p2), return pOrdSgn, return -pOrdSgn);
    492   NonZeroR(RevLexComp(p1, p2), return pLexSgn, return -pLexSgn);
    493   NonZeroR(pGetComp(p1) - pGetComp(p2),
    494            return -pComponentOrder, return pComponentOrder);
    495   return 0;
    496 }
    497 
    498 #endif // COMP_TRADITIONAL
    499 
    500341/*2
    501342* compare the head monomial of p1 and p2 with weight vector
     
    503344static int comp1a  ( poly p1, poly p2, int f, int l, short * w )
    504345{
    505   int d= p1->Order - p2->Order;
     346  int d= pGetOrder(p1) - pGetOrder(p2);
    506347  if ( d > 0 /*p1->Order > p2->Order*/ )
    507348    return 1;
     
    1023864static int mcompSyz(poly p1,poly p2)
    1024865{
    1025   if (pGetComp(p1)<=maxBound)
    1026   {
    1027     if (pGetComp(p2)>maxBound) return 1;
    1028   }
    1029   else if (pGetComp(p2)<=maxBound)
     866  if (pGetComp(p1)<=pMaxBound)
     867  {
     868    if (pGetComp(p2)>pMaxBound) return 1;
     869  }
     870  else if (pGetComp(p2)<=pMaxBound)
    1030871  {
    1031872    return -1;
     
    1038879  if (k!=0)
    1039880  {
    1040     if (maxBound==0)
     881    if (pMaxBound==0)
    1041882    {
    1042883      pCompOld = pComp0;
    1043884      pComp0 = mcompSyz;
    1044885    }
    1045     maxBound = k;
     886    pMaxBound = k;
    1046887  }
    1047888  else
    1048889  {
    1049     if (maxBound!=0)
     890    if (pMaxBound!=0)
    1050891    {
    1051892      pComp0 = pCompOld;
    1052       maxBound = 0;
     893      pMaxBound = 0;
    1053894    }
    1054895  }
     
    11651006  int ll=1;
    11661007
    1167   if (maxBound/*syzComp*/==0)
     1008  if (pMaxBound/*syzComp*/==0)
    11681009  {
    11691010    while ((p=pNext(p))!=NULL)
     
    11771018    while ((p=pNext(p))!=NULL)
    11781019    {
    1179       if (pGetComp(p)<=maxBound/*syzComp*/)
     1020      if (pGetComp(p)<=pMaxBound/*syzComp*/)
    11801021      {
    11811022        o=pFDeg(p);
     
    12451086  while ((p=pNext(p))!=NULL)
    12461087  {
    1247     if ((maxBound/*syzComp*/==0) || (pGetComp(p)<=maxBound/*syzComp*/))
     1088    if ((pMaxBound/*syzComp*/==0) || (pGetComp(p)<=pMaxBound/*syzComp*/))
    12481089    {
    12491090       if ((t=pFDeg(p))>max) max=t;
     
    12601101
    12611102
    1262 /*2
    1263 * sets the comparision routine for monomials: for the first block
    1264 * of variables (o_r is the number of the ordering)
    1265 */
    1266 #ifdef COMP_FAST
     1103/*
     1104* sets the comparision routine for monomials: for simple monomial orderings
     1105* Priority is given to exponent vector
     1106*/
    12671107static void SimpleChoose(int o_r, int comp_order, pCompProc *p)
    1268 #else 
    1269 static void SimpleChoose(int o_r, pCompProc *p)
    1270 #endif 
    1271 {
    1272 #ifdef COMP_FAST
     1108{
    12731109  switch(o_r)
    12741110  {
     
    12831119        if (comp_order == ringorder_C || o_r == ringorder_unspec)
    12841120        {
    1285           if (pVariables1W == 1)
    1286             f_pComp0 = f_comp_otEXPCOMP_nwONE;
    1287           else if (pVariables1W == 2)
    1288             f_pComp0 = f_comp_otEXPCOMP_nwTWO;
    1289           else if (pVariables1W & 1)
    1290             f_pComp0 = f_comp_otEXPCOMP_nwODD;
    1291           else
    1292             f_pComp0 = f_comp_otEXPCOMP_nwEVEN;
     1121          if (pVariables1W == 1)        *p = pComp_otEXPCOMP_nwONE;
     1122          else if (pVariables1W == 2)   *p = pComp_otEXPCOMP_nwTWO;
     1123          else if (pVariables1W & 1)    *p = pComp_otEXPCOMP_nwODD;
     1124          else                          *p = pComp_otEXPCOMP_nwEVEN;
    12931125        }
    12941126        else
    12951127        {
    1296           if (pVariables1W == 1)
    1297             f_pComp0 = f_comp_otEXP_nwONE;
    1298           else if (pVariables1W == 2)
    1299             f_pComp0 = f_comp_otEXP_nwTWO;
    1300           else if (pVariables1W & 1)
    1301             f_pComp0 = f_comp_otEXP_nwODD;
    1302           else
    1303             f_pComp0 = f_comp_otEXP_nwEVEN;
     1128          // component is compatible with exponent vector
     1129          if (pVariables1W == 1)        *p = pComp_otEXP_nwONE;
     1130          else if (pVariables1W == 2)   *p = pComp_otEXP_nwTWO;
     1131          else if (pVariables1W & 1)    *p = pComp_otEXP_nwODD;
     1132          else                          *p = pComp_otEXP_nwEVEN;
    13041133        }
    13051134        break;
     
    13181147        if (comp_order == ringorder_c)
    13191148        {
    1320           if (pVariables1W == 1)
    1321             f_pComp0 = f_comp_otEXPCOMP_nwONE;
    1322           else if (pVariables1W == 2)
    1323             f_pComp0 = f_comp_otEXPCOMP_nwTWO;
    1324           else if (pVariables1W & 1)
    1325             f_pComp0 = f_comp_otEXPCOMP_nwODD;
    1326           else
    1327             f_pComp0 = f_comp_otEXPCOMP_nwEVEN;
     1149          if (pVariables1W == 1)        *p = pComp_otEXPCOMP_nwONE;
     1150          else if (pVariables1W == 2)   *p = pComp_otEXPCOMP_nwTWO;
     1151          else if (pVariables1W & 1)    *p = pComp_otEXPCOMP_nwODD;
     1152          else                          *p = pComp_otEXPCOMP_nwEVEN;
    13281153        }
    13291154        else
    13301155        {
    1331           if (pVariables1W == 1)
    1332             f_pComp0 = f_comp_otEXP_nwONE;
    1333           else if (pVariables1W == 2)
    1334             f_pComp0 = f_comp_otEXP_nwTWO;
    1335           else if (pVariables1W & 1)
    1336             f_pComp0 = f_comp_otEXP_nwODD;
    1337           else
    1338             f_pComp0 = f_comp_otEXP_nwEVEN;
     1156          // component is compatible with exponent vector
     1157          if (pVariables1W == 1)        *p = pComp_otEXP_nwONE;
     1158          else if (pVariables1W == 2)   *p = pComp_otEXP_nwTWO;
     1159          else if (pVariables1W & 1)    *p = pComp_otEXP_nwODD;
     1160          else                          *p = pComp_otEXP_nwEVEN;
    13391161        }
    13401162#ifdef PDEBUG
     
    13531175      pSetVarIndicies_Lex(pVariables);
    13541176  }
    1355   *p = f_pComp0;
    1356 #endif // COMP_FAST 
    1357 
     1177}
     1178
     1179/*
     1180* sets the comparision routine for monomials: for simple monomial orderings
     1181* Priority is given to component
     1182*/
     1183static void SimpleChooseC(int o_r, pCompProc *p)
     1184{
     1185  switch(o_r)
     1186  {
     1187      case ringorder_dp:
     1188      case ringorder_wp:
     1189      case ringorder_ds:
     1190      case ringorder_ls:
     1191      case ringorder_ws:
     1192        pSetVarIndicies_RevLex(pVariables);
     1193        pLexSgn = -1;
     1194        if (pVariablesW == 1)
     1195          *p = pComp_otCOMPEXP_nwONE;
     1196        else if (pVariablesW == 2)
     1197          *p = pComp_otCOMPEXP_nwTWO;
     1198        else if (pVariablesW & 1)
     1199          *p = pComp_otCOMPEXP_nwODD;
     1200        else
     1201          *p = pComp_otCOMPEXP_nwEVEN;
     1202        break;
     1203       
     1204#ifdef PDEBUG
     1205      case ringorder_lp:
     1206      case ringorder_Dp:
     1207      case ringorder_Wp:
     1208      case ringorder_Ds:
     1209      case ringorder_Ws:
     1210#else
     1211      default:
     1212#endif
     1213        pSetVarIndicies_Lex(pVariables);
     1214        pLexSgn = 1;
     1215        if (pVariablesW == 1)
     1216          *p = pComp_otCOMPEXP_nwONE;
     1217        else if (pVariablesW == 2)
     1218          *p = pComp_otCOMPEXP_nwTWO;
     1219        else if (pVariablesW & 1)
     1220          *p = pComp_otCOMPEXP_nwODD;
     1221        else
     1222          *p = pComp_otCOMPEXP_nwEVEN;
     1223#ifdef PDEBUG
     1224        break;
     1225      default:
     1226        Werror("wrong internal ordering:%d at %s, l:%d\n",o_r,__FILE__,__LINE__);
     1227#endif
     1228  }
     1229  if (o_r == ringorder_lp || o_r == ringorder_ls)
     1230  {
     1231    pLexOrder=TRUE;
     1232    pFDeg = pTotaldegree;
     1233    pLDeg = ldeg1c;
     1234    if (o_r == ringorder_ls)
     1235     pSetVarIndicies_Lex(pVariables);
     1236  }
    13581237}
    13591238
     
    14011280}
    14021281
    1403 /*2
    1404 * sets the comparision routine for monomials: for the first block
    1405 * of variables (o_r is the number of the ordering)
    1406 */
    1407 #ifdef COMP_FAST
    1408 static void SimpleChooseC(int o_r, int comp_order, pCompProc *p)
    1409 #else 
    1410 static void SimpleChooseC(int o_r, pCompProc *p)
    1411 #endif 
    1412 {
    1413 #ifdef COMP_FAST
    1414   switch(o_r)
    1415   {
    1416       case ringorder_dp:
    1417       case ringorder_wp:
    1418       case ringorder_ds:
    1419       case ringorder_ls:
    1420       case ringorder_ws:
    1421         pSetVarIndicies_RevLex(pVariables);
    1422         pLexSgn = -1;
    1423         if (pVariablesW == 1)
    1424           f_pComp0 = f_comp_otCOMPEXP_nwONE;
    1425         else if (pVariablesW == 2)
    1426           f_pComp0 = f_comp_otCOMPEXP_nwTWO;
    1427         else if (pVariablesW & 1)
    1428           f_pComp0 = f_comp_otCOMPEXP_nwODD;
    1429         else
    1430           f_pComp0 = f_comp_otCOMPEXP_nwEVEN;
    1431         break;
    1432        
    1433 #ifdef PDEBUG
    1434       case ringorder_lp:
    1435       case ringorder_Dp:
    1436       case ringorder_Wp:
    1437       case ringorder_Ds:
    1438       case ringorder_Ws:
    1439 #else
    1440       default:
    1441 #endif
    1442         pSetVarIndicies_Lex(pVariables);
    1443         pLexSgn = 1;
    1444         if (pVariablesW == 1)
    1445           f_pComp0 = f_comp_otCOMPEXP_nwONE;
    1446         else if (pVariablesW == 2)
    1447           f_pComp0 = f_comp_otCOMPEXP_nwTWO;
    1448         else if (pVariablesW & 1)
    1449           f_pComp0 = f_comp_otCOMPEXP_nwODD;
    1450         else
    1451           f_pComp0 = f_comp_otCOMPEXP_nwEVEN;
    1452 #ifdef PDEBUG
    1453         break;
    1454       default:
    1455         Werror("wrong internal ordering:%d at %s, l:%d\n",o_r,__FILE__,__LINE__);
    1456 #endif
    1457   }
    1458   if (o_r == ringorder_lp || o_r == ringorder_ls)
    1459   {
    1460     pLexOrder=TRUE;
    1461     pFDeg = pTotaldegree;
    1462     pLDeg = ldeg1c;
    1463     if (o_r == ringorder_ls)
    1464      pSetVarIndicies_Lex(pVariables);
    1465   }
    1466   *p = f_pComp0;
    1467 #endif // COMP_FAST 
    1468 
    1469 #ifdef COMP_DEBUG
    1470     *p = debug_comp;
    1471 #endif 
    1472 }
    14731282
    14741283/*2
     
    15411350}
    15421351
    1543 #ifdef DIV_COUNT
    1544 struct div_triple
    1545 {
    1546   unsigned long greater;
    1547   unsigned long equal;
    1548   unsigned long smaller;
    1549 };
    1550 
    1551 static div_triple* DivTriples = NULL;
    1552 static int NumberOfDivTriples = 0;
    1553 static unsigned long DivCountTotal = 0;
    1554 static unsigned long DivCountDiv = 0;
    1555 static unsigned long LexDivCount = 0;
    1556 static unsigned long RevLexDivCount = 0;
    1557 static unsigned long LexDivCount2 = 0;
    1558 static unsigned long RevLexDivCount2 = 0;
    1559 static int pVariables2;
    1560 static int pVariablesEven;
    1561 
    1562 void InitDivCount(int nvars)
    1563 {
    1564   if (nvars & 1) pVariablesEven = 0;
    1565   else pVariablesEven = 1;
    1566 
    1567   pVariables2 = (pVariables -1) / 2;
    1568 
    1569   if (DivTriples == NULL)
    1570     {
    1571       DivTriples = (div_triple*) Alloc0(nvars*sizeof(div_triple));
    1572       NumberOfDivTriples = nvars;
    1573     }
    1574   else if (nvars > NumberOfDivTriples)
    1575     {
    1576       DivTriples = (div_triple*) ReAlloc(DivTriples,
    1577                                          NumberOfDivTriples*sizeof(div_triple),
    1578                                          nvars*sizeof(div_triple));
    1579       for (int i=NumberOfDivTriples; i<nvars; i++)
    1580         {
    1581           DivTriples[i].greater = 0;
    1582           DivTriples[i].smaller = 0;
    1583           DivTriples[i].equal = 0;
    1584         }
    1585 
    1586       NumberOfDivTriples = nvars;
    1587     }
    1588 }
    1589 
    1590 void ResetDivCount()
    1591 {
    1592   int i;
    1593   for (i=0; i<NumberOfDivTriples;i++)
    1594     {
    1595       DivTriples[i].greater = 0;
    1596       DivTriples[i].equal = 0;
    1597       DivTriples[i].smaller = 0;
    1598     }
    1599 
    1600   DivCountTotal = 0;
    1601   DivCountDiv = 0;
    1602   LexDivCount = 0;
    1603   RevLexDivCount = 0;
    1604   LexDivCount2 = 0;
    1605   RevLexDivCount2 = 0;
    1606 }
    1607 
    1608 void OutputDivCount()
    1609 {
    1610   printf("Total      : %10u\n", DivCountTotal);
    1611   if (DivCountTotal == 0) DivCountTotal++;
    1612   printf("Div        : %10u \t %.4f\n", DivCountDiv,
    1613          (float) DivCountDiv / (float) DivCountTotal);
    1614   printf("LexCount   :  %10u \t %.4f\n", LexDivCount,
    1615          (float) LexDivCount / (float) DivCountTotal);
    1616   printf("RevLexCount:  %10u \t %.4f\n", RevLexDivCount,
    1617          (float) RevLexDivCount / (float) DivCountTotal);
    1618   printf("LexCount2   :  %10u \t %.4f\n", LexDivCount2,
    1619          (float) LexDivCount2 / (float) DivCountTotal);
    1620   printf("RevLexCount2:  %10u \t %.4f\n", RevLexDivCount2,
    1621          (float) RevLexDivCount2 / (float) DivCountTotal);
    1622 
    1623   for (int i=0; i<NumberOfDivTriples; i++)
    1624     {
    1625       unsigned long total = DivTriples[i].greater +
    1626         DivTriples[i].equal + DivTriples[i].smaller;
    1627       // avoid total==0
    1628       if (total == 0) total=1;
    1629       printf("  [%d]: %10u (%.4f)  %10u (%.4f)  %10u (%.4f)\n", i,
    1630              DivTriples[i].greater,
    1631              (float) DivTriples[i].greater / (float) total ,
    1632              DivTriples[i].equal,
    1633              (float) DivTriples[i].equal / (float) total  ,
    1634              DivTriples[i].smaller,
    1635              (float) DivTriples[i].smaller / (float) total  );
    1636     }
    1637 }
    1638 
    1639 BOOLEAN pDivisibleBy(poly a, poly b)
    1640 {
    1641   if ((a!=NULL)&&(( pGetComp(a)==0) || ( pGetComp(a) ==  pGetComp(b))))
    1642   {
    1643     int i;
    1644     Exponent_t *e1=&( pGetExp(a,1));
    1645     Exponent_t *e2=&( pGetExp(b,1));
    1646     BOOLEAN res = TRUE, res2 = TRUE;
    1647     DivCountTotal++;
    1648 
    1649     for (i=0; i<pVariables; i++)
    1650     {
    1651       if (res == TRUE) LexDivCount++;
    1652       if (*e1 > *e2)
    1653       {
    1654         DivTriples[i].greater++;
    1655         res = FALSE;
    1656       }
    1657       else if (*e1 == *e2)  DivTriples[i].equal++;
    1658       else DivTriples[i].smaller++;
    1659       e1++;
    1660       e2++;
    1661     }
    1662     if (res == TRUE) DivCountDiv++;
    1663     e1 = &(pGetExp(a,pVariables));
    1664     e2 = &(pGetExp(b,pVariables));
    1665 
    1666     for (i=0; i<pVariables; i++)
    1667     {
    1668       RevLexDivCount++;
    1669       if (*e1 > *e2)
    1670       {
    1671         res2 = FALSE;
    1672         break;
    1673       }
    1674       e1--;
    1675       e2--;
    1676     }
    1677     if (res != res2)
    1678       fprintf(stderr, "Error in RevLexCount\n");
    1679    
    1680     if (pVariables < 4) return res;
    1681     LexTop:
    1682     res2 = TRUE;
    1683     int* s1 = (int*) &( pGetExp(a,2));
    1684     int* s2 = (int*) &( pGetExp(b,2));
    1685     for (i=0; i<pVariables2; i++, s1++, s2++)
    1686     {
    1687       LexDivCount2++;
    1688       if (*s1 > *s2)
    1689           {
    1690             res2 = FALSE;
    1691             break;
    1692           }
    1693     }
    1694     if (res2 == TRUE)
    1695     {
    1696       LexDivCount2++;
    1697       if ( pGetExp(a,1) >  pGetExp(b,1)) res2 = FALSE;
    1698       if (res2 == TRUE && pVariablesEven)
    1699           {
    1700             LexDivCount2++;
    1701             if (pGetExp(a,pVariables) > pGetExp(b,pVariables))
    1702               res2 = FALSE;
    1703           }
    1704     }
    1705     if (res2 == TRUE)
    1706     {
    1707       e1 = &( pGetExp(a,2));
    1708       e2 = &( pGetExp(b,2));
    1709       for (i=0; i<pVariables2; i++, e1 += 2, e2 += 2)
    1710       {
    1711         LexDivCount++;
    1712 #ifdef WORDS_BIG_ENDIAN
    1713         if (e1[1] > e2[1])
    1714 #else
    1715         if (*e1 > *e2)
    1716 #endif
    1717         {
    1718           res2 = FALSE;
    1719           break;
    1720         }
    1721       }
    1722     }
    1723     if (res != res2)
    1724     {
    1725       fprintf(stderr, "Error in LexDivCount2\n");
    1726       // goto LexTop;
    1727     }
    1728    
    1729     RevLexTop:
    1730     res2 = TRUE;
    1731     if (pVariablesEven)
    1732     {
    1733       s1 = (int*) &(pGetExp(a,pVariables-2));
    1734       s2 = (int*) &(pGetExp(b,pVariables-2));
    1735     }
    1736     else
    1737     {
    1738       s1 = (int*) &(pGetExp(a,pVariables-1));
    1739       s2 = (int*) &(pGetExp(b,pVariables-1));
    1740     }
    1741     for (i=0; i< pVariables2; i++, s1--, s2--)
    1742     {
    1743       RevLexDivCount2++;
    1744       if (*s1 > *s2)
    1745           {
    1746             res2 = FALSE;
    1747             break;
    1748           }
    1749     }
    1750     if (res2 == TRUE)
    1751     {
    1752       if (pVariablesEven)
    1753           {
    1754             RevLexDivCount2++;
    1755             if (pGetExp(a,pVariables) > pGetExp(b,pVariables))
    1756               res2 = FALSE;
    1757           }
    1758       if (res2 == TRUE)
    1759           {
    1760             RevLexDivCount2++;
    1761             if ( pGetExp(a,1) >  pGetExp(b,1)) res2 = FALSE;
    1762           }
    1763     }
    1764     if (res2 == TRUE)
    1765     {
    1766       if (pVariablesEven)
    1767       {
    1768         e1 = &(pGetExp(a,pVariables-2));
    1769         e2 = &(pGetExp(b,pVariables-2));
    1770       }
    1771       else
    1772       {
    1773         e1 = &(pGetExp(a,pVariables-1));
    1774         e2 = &(pGetExp(b,pVariables-1));
    1775       }
    1776       for (i=0; i<pVariables2; i++, e1 -= 2, e2 -= 2)
    1777       {
    1778 #ifdef WORDS_BIG_ENDIAN     
    1779       if (e1[1] > e2[1])
    1780 #else
    1781       if (*e1 > *e2) 
    1782 #endif       
    1783         {
    1784           res2 = FALSE;
    1785           break;
    1786         }
    1787       }
    1788     }
    1789     if (res != res2)
    1790     {
    1791       fprintf(stderr, "Error in RevLexDivCount2\n");
    1792       // goto RevLexTop;
    1793     }
    1794     return res;
    1795   }
    1796   return FALSE;
    1797 }
    1798 #endif
    1799 
    18001352/* -------------------------------------------------------- */
    18011353/*2
     
    18191371void pSetGlobals(ring r, BOOLEAN complete)
    18201372{
    1821 #ifdef TEST_MAC_ORDER
    1822   bNoAdd=FALSE;
    1823 #endif
    18241373  int i;
    18251374  pComponentOrder=1;
     
    18291378  pAltVars=r->N+1;
    18301379#endif
    1831 #ifdef COMP_FAST
    1832   f_pComp0 = NULL;
    1833 #endif 
    18341380  pVariables = r->N;
    18351381
    18361382  // set the various size parameters and initialize memory
    1837   pMonomSize = POLYSIZE + (pVariables + 1) * sizeof(Exponent_t);
    1838   if ((pMonomSize % sizeof(void*)) == 0)
    1839   {
    1840     pMonomSizeW = pMonomSize/sizeof(void*);
    1841   }
    1842   else
    1843   {
    1844     pMonomSizeW = pMonomSize/sizeof(void*) + 1;
    1845     pMonomSize = pMonomSizeW*sizeof(void*);
    1846   }
    1847 
    1848 #ifdef COMP_FAST 
    18491383  if ((((pVariables+1)*sizeof(Exponent_t)) % sizeof(void*)) == 0)
    18501384    pVariables1W = (pVariables+1)*sizeof(Exponent_t) / sizeof(void*);
    18511385  else
    18521386    pVariables1W = ((pVariables+1)*sizeof(Exponent_t) / sizeof(void*)) + 1;
     1387
    18531388  if ((((pVariables)*sizeof(Exponent_t)) % sizeof(void*)) == 0)
    18541389    pVariablesW = (pVariables)*sizeof(Exponent_t) / sizeof(void*);
    18551390  else
    18561391    pVariablesW = ((pVariables)*sizeof(Exponent_t) / sizeof(void*)) + 1;
     1392
     1393  pMonomSize = POLYSIZE + (pVariables + 1) * sizeof(Exponent_t);
     1394  if ((pMonomSize % sizeof(void*)) == 0)
     1395  {
     1396    pMonomSizeW = pMonomSize/sizeof(void*);
     1397  }
     1398  else
     1399  {
     1400    pMonomSizeW = pMonomSize/sizeof(void*) + 1;
     1401    pMonomSize = pMonomSizeW*sizeof(void*);
     1402  }
    18571403 
    18581404  // Set default Var Indicies
    18591405  pSetVarIndicies(pVariables);
    1860 #endif
     1406
     1407  // Initialize memory management
    18611408  mmSpecializeBlock(pMonomSize);
    18621409 
     
    18861433      pComponentOrder=-1;
    18871434    if (pOrdSgn == -1) pLDeg = ldeg0c;
    1888 #ifdef COMP_FAST   
    18891435    SimpleChoose(order[0],order[1], &pComp0);
    1890 #else   
    1891     SimpleChoose(order[0],&pComp0);
    1892 #endif   
    18931436    SetpSetm(order[0],0);
    1894 #ifdef TEST_MAC_ORDER
    1895     if (order[0]==ringorder_dp)
    1896        bBinomSet(order);
    1897 #endif
    18981437  }
    18991438  /*======== ordering type is (c,_) =========================*/
     
    19051444    if (order[0]==ringorder_C)
    19061445      pComponentOrder=-1;
    1907 #ifdef COMP_FAST
    1908     SimpleChooseC(order[1],pComponentOrder, &pComp0);
    1909 #else   
    1910     SimpleChooseC(order[1],&pComp0);
    1911 #endif   
     1446    SimpleChooseC(order[1], &pComp0);
    19121447    SetpSetm(order[1],1);
    1913 #ifdef TEST_MAC_ORDER
    1914     if (order[1]==ringorder_dp)
    1915        bBinomSet(order);
    1916 #endif
    19171448  }
    19181449  /*------- more than one block ----------------------*/
     
    19551486    test &= ~Sy_bit(OPT_REDTAIL); /* noredTail */
    19561487  }
    1957 
    1958 #ifdef COMP_FAST
    1959   if (f_pComp0 == NULL)
    1960     f_pComp0 = pComp0;
    1961 #endif
    1962  
    1963 #ifdef DIV_COUNT
    1964   InitDivCount(pVariables);
    1965 #endif
    19661488}
    19671489
     
    26352157* pair has no common factor ? or is no polynomial
    26362158*/
    2637 #ifdef COMP_FAST
    26382159BOOLEAN pHasNotCF(poly p1, poly p2)
    26392160{
     
    26452166  if (pGetComp(p1) > 0 || pGetComp(p2) > 0)
    26462167    return FALSE;
    2647   Exponent_t * m1 = &(p1->exp[pVarLowIndex]);
    2648   Exponent_t * m2 = &(p2->exp[pVarLowIndex]);
    26492168  int i = 1;
    26502169  loop
    26512170  {
    2652     if (((*m1) > 0) && ((*m2) > 0))
    2653       return FALSE;
    2654     if (i == pVariables)
    2655       return TRUE;
    2656     m1++;m2++;
     2171    if ((pGetExp(p1, i) > 0) && (pGetExp(p2, i) > 0))   return FALSE;
     2172    if (i == pVariables)                                return TRUE;
    26572173    i++;
    26582174  }
    26592175}
    2660 #else
    2661 BOOLEAN pHasNotCF(poly p1, poly p2)
    2662 {
    2663 #ifdef SRING
    2664   if (pSRING)
    2665     return FALSE;
    2666 #endif
    2667   short * m1 = p1->exp;
    2668   short * m2 = p2->exp;
    2669 
    2670   if (((*m1) > 0)||((*m2) > 0))
    2671     return FALSE;
    2672   int i = 1;
    2673   loop
    2674   {
    2675     m1++;m2++;
    2676     if (((*m1) > 0) && ((*m2) > 0))
    2677       return FALSE;
    2678     if (i == pVariables)
    2679       return TRUE;
    2680     i++;
    2681   }
    2682 }
    2683 #endif
    2684 /*
    2685 *void    pSFactors(poly f, poly g, poly a, poly b)
    2686 *{
    2687 *  int i,d;
    2688 *
    2689 *  for (i=pVariables;i>0;i--)
    2690 *  {
    2691 *    d =  pGetExp(f,i)- pGetExp(g,i);
    2692 *    if (d >= 0)
    2693 *    {
    2694 *       pGetExp(a,i) = 0;
    2695 *       pGetExp(b,i) = d;
    2696 *    }
    2697 *    else
    2698 *    {
    2699 *       pGetExp(a,i) = -d;
    2700 *       pGetExp(b,i) = 0;
    2701 *    }
    2702 *  }
    2703 *   pGetComp(a) = 0;
    2704 *   pGetComp(b) = 0;
    2705 *  pSetm(a);
    2706 *  pSetm(b);
    2707 *}
    2708 */
    2709 
    2710 /*
    2711 *void    pSDiv(poly f, poly g, poly b)
    2712 *{
    2713 *  int i,d;
    2714 *
    2715 *  for (i=pVariables;i>0;i--)
    2716 *  {
    2717 *    d =  pGetExp(f,i)- pGetExp(g,i);
    2718 *     pGetExp(b,i) = d;
    2719 *  }
    2720 *   pGetComp(b) = 0;
    2721 *  pSetm(b);
    2722 *}
    2723 */
    2724 
    2725 /*2
    2726 * update the initial term of a polynomial a by multipying it by
    2727 * the (number) coefficient
    2728 * and the exponent vector (of) exp (a well initialized polynomial)
    2729 */
    2730 /*
    2731 *void    pSMultBy(poly f, poly m)
    2732 *{
    2733 *  number t;
    2734 *  int i;
    2735 * //  short notok;
    2736 *
    2737 *  t=nMult(f->coef, m->coef);
    2738 *  nDelete(&(f->coef));
    2739 *  f->coef = t;
    2740 *  f->Order  += m->Order;
    2741 *  for (i=pVariables; i; i--)
    2742 *     pGetExp(f,i) +=  pGetExp(m,i);
    2743 * //  if (notok)
    2744 * //  {
    2745 *    if (!( pGetComp(f)))
    2746 *    {
    2747 *       pGetComp(f) =  pGetComp(m);
    2748 *    }
    2749 * //    else
    2750 * //    {
    2751 * //      HALT;
    2752 * //    }
    2753 * //  }
    2754 *}
    2755 */
    27562176
    27572177
     
    27612181*              0 otherwise
    27622182*/
    2763 #ifdef COMP_FAST
    27642183int     pDivComp(poly p, poly q)
    27652184{
    27662185  if (pGetComp(p) == pGetComp(q))
    27672186  {
    2768     Exponent_t * mp = &(p->exp[pVarLowIndex]);
    2769     Exponent_t * mq = &(q->exp[pVarLowIndex]);
    27702187    int i=pVariables;
     2188    long d;
    27712189    BOOLEAN a=FALSE, b=FALSE;
    27722190    for (; i>0; i--)
    27732191    {
    2774       if (*mp<*mq)
     2192      d = pGetExpDiff(p, q, i);
     2193      if (d)
    27752194      {
    2776         if (b) return 0;
    2777         a =TRUE;
     2195        if (d < 0)
     2196        {
     2197          if (b) return 0;
     2198          a =TRUE;
     2199        }
     2200        else
     2201        {
     2202          if (a) return 0;
     2203          b = TRUE;
     2204        }
    27782205      }
    2779       else if (*mp>*mq)
    2780       {
    2781         if (a) return 0;
    2782         b = TRUE;
    2783       }
    2784       mp++;mq++;
    27852206    }
    27862207    if (a) return 1;
     
    27892210  return 0;
    27902211}
    2791 #else
    2792 int     pDivComp(poly p, poly q)
    2793 {
    2794   short * mp = p->exp;
    2795   short * mq = q->exp;
    2796 
    2797   if (*mp==*mq)
    2798   {
    2799     int i=pVariables;
    2800     BOOLEAN a=FALSE, b=FALSE;
    2801     for (; i>0; i--)
    2802     {
    2803       mp++;mq++;
    2804       if (*mp<*mq)
    2805       {
    2806         if (b) return 0;
    2807         a =TRUE;
    2808       }
    2809       else if (*mp>*mq)
    2810       {
    2811         if (a) return 0;
    2812         b = TRUE;
    2813       }
    2814     }
    2815     if (a) return 1;
    2816     else if (b)  return -1;
    2817   }
    2818   return 0;
    2819 }
    2820 #endif
    28212212/*2
    28222213*divides p1 by its leading monomial
     
    29512342      if (pGetExp(p,j)!=pGetExp(lcm,j))
    29522343      {
    2953         for (k=pVariables; k>j; k--)
    2954         {
     2344        for (k=pVariables; k>j; k--)        {
    29552345          if ((pGetExp(p,k)!=pGetExp(lcm,k))
    29562346          && (pGetExp(p2,k)!=pGetExp(lcm,k)))
     
    29992389
    30002390
    3001 #ifdef COMP_STATISTICS
    3002 static int s_comp_lp_otCOMPEXP_1(poly p1, poly p2) 
    3003 {
    3004   MonomCountTotal++;
    3005 
    3006   OrderCmp(p2, p1,
    3007            {MonomCountOrderS++; return -1;},
    3008            {MonomCountOrderG++; return 1;});
    3009  
    3010   CompCmp(p2, p1,
    3011           {MonomCountCompS++; return -pComponentOrder},
    3012           {MonomCountCompG++; return pComponentOrder});
    3013 
    3014   MonomCountEqual++;
    3015   return 0;
    3016 }
    3017 #endif
    3018 
    3019 #ifdef COMP_STATISTICS
    3020 static int s_comp_lp_otCOMPEXP_i(poly p1, poly p2) 
    3021 {
    3022   MonomCountTotal++;
    3023 
    3024   OrderCmp(p2, p1,
    3025            {MonomCountOrderS++; return -1;},
    3026            {MonomCountOrderG++; return 1;});
    3027 
    3028   int i = SIZEOF_ORDER / SIZEOF_EXPONENT + 1;
    3029   Exponent_t d;
    3030  
    3031 
    3032   for (;;)
    3033   {
    3034     d = pGetExp(p1, i)  - pGetExp(p2, i);
    3035     if (d)
    3036     {
    3037       MonomCountExp[i]++;
    3038       if (d < 0)
    3039       {
    3040         return -1;
    3041         MonomCountExpS++;
    3042       }
    3043       MonomCountExpG++;
    3044       return 1;
    3045     }
    3046     i++;
    3047     if (i == pVariables) break;
    3048   }
    3049  
    3050   CompCmp(p2, p1,
    3051           {MonomCountCompS++; return -pComponentOrder},
    3052           {MonomCountCompG++; return pComponentOrder});
    3053 
    3054   MonomCountEqual++;
    3055   return 0;
    3056 }
    3057 #endif
    3058 
    3059 #ifdef MONOM_COUNT
    3060 static void InitMonomCount(unsigned int nvars)
    3061 {
    3062   if (gMonomCount == NULL)
    3063   {
    3064     gMonomCount = (unsigned long *) Alloc0(nvars*sizeof(int));
    3065     gMonomCountLength = nvars;
    3066   }
    3067   else if (gMonomCountLength < nvars)
    3068   {
    3069     int i;
    3070     gMonomCount = (unsigned long *) ReAlloc(gMonomCount,
    3071                                           gMonomCountLength*sizeof(int),
    3072                                           nvars*sizeof(int));
    3073     for (i = gMonomCountLength; i< nvars; i++)
    3074       gMonomCount[i] = 0;
    3075     gMonomCountLength = nvars;
    3076   }
    3077 }
    3078 
    3079 void OutputMonomCount()
    3080 {
    3081   unsigned int i;
    3082   unsigned long max = gMonomCount0;
    3083   float fmax;
    3084   unsigned long sum = 0;
    3085  
    3086 
    3087   // check that everything went ok
    3088   if (gMonomCountS !=
    3089       gMonomCount0 + gMonomCountOrder + gMonomCountL + gMonomCountG)
    3090   {
    3091     printf("MonomCountTotalError: %10lu %10lu\n", gMonomCountS,
    3092            gMonomCount0 + gMonomCountOrder + gMonomCountL + gMonomCountG);
    3093   }
    3094   for (i=0; i<gMonomCountLength; i++)
    3095     sum += gMonomCount[i];
    3096   if (sum != gMonomCountL + gMonomCountG)
    3097   {
    3098     printf("MonomCountNotEqualError: %10lu %10lu\n",
    3099            gMonomCountL + gMonomCountG, sum);
    3100   }
    3101 
    3102   printf("Total   : %10lu\n", gMonomCountS);
    3103   if (gMonomCountS == 0) gMonomCountS = 1;
    3104  
    3105   printf("Order   : %10lu \t %.4f\n",gMonomCountOrder,
    3106          (float) gMonomCountOrder / (float) gMonomCountS);
    3107   printf("Equal   : %10lu \t %.4f\n",gMonomCount0,
    3108          (float) gMonomCount0 / (float) gMonomCountS);
    3109   printf("NotEqual: %10lu \t %.4f\n",gMonomCountL + gMonomCountG,
    3110          ((float) gMonomCountL + gMonomCountG) / (float) gMonomCountS);
    3111   printf("\tGreater: %10lu \t %.4f\n",gMonomCountG,
    3112          (float) gMonomCountG / (float) gMonomCountS);
    3113   printf("\tLess   : %10lu \t %.4f\n",gMonomCountL,
    3114          (float) gMonomCountL / (float) gMonomCountS);
    3115 
    3116   for (i=0; i<gMonomCountLength; i++)
    3117   {
    3118     printf("\t\t[%d]    : %10lu \t %.4f\n", i, gMonomCount[i],
    3119            (float) gMonomCount[i] / (float) gMonomCountS);
    3120   }
    3121   printf("E1Neg   : %10lu \t %.4f\n",gMonomCountN1,
    3122          (float) gMonomCountN1 / (float) gMonomCountS);
    3123   printf("E2Neg   : %10lu \t %.4f\n",gMonomCountN2,
    3124          (float) gMonomCountN2 / (float) gMonomCountS);
    3125   printf("BothNeg : %10lu \t %.4f\n",gMonomCountNN,
    3126          (float) gMonomCountNN / (float) gMonomCountS);
    3127   printf("Mcount2 : %u\n", gMcount2);
    3128 }
    3129 
    3130 void ResetMonomCount()
    3131 {
    3132   int i;
    3133 
    3134   for (i=0; i<gMonomCountLength; i++)
    3135     gMonomCount[i] = 0;
    3136   gMonomCountOrder = 0;
    3137   gMonomCount0 = 0;
    3138   gMonomCountS = 0;
    3139   gMonomCountG = 0;
    3140   gMonomCountL = 0;
    3141   gMonomCountN1 = 0;
    3142   gMonomCountN2 = 0;
    3143   gMonomCountNN = 0;
    3144   gMcount2 = 0;
    3145 }
    3146 
    3147 #endif
    3148 #ifdef MONOM_COUNT
    3149 unsigned long  gMonomCount0 = 0;
    3150 unsigned long  gMonomCountLength = 0;
    3151 unsigned long  gMonomCountOrder = 0;
    3152 unsigned long  gMonomCountG = 0;
    3153 unsigned long  gMonomCountL = 0;
    3154 unsigned long  gMonomCountS = 0;
    3155 unsigned long  gMonomCountN1 = 0;
    3156 unsigned long  gMonomCountN2 = 0;
    3157 unsigned long  gMonomCountNN = 0;
    3158 unsigned long  gMcount2 = 0;
    3159 unsigned long* gMonomCount = NULL;
    3160 #endif
  • Singular/ring.cc

    r7f1b91 r18255d  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ring.cc,v 1.17 1998-03-18 14:28:52 obachman Exp $ */
     4/* $Id: ring.cc,v 1.18 1998-03-19 16:05:51 obachman Exp $ */
    55
    66/*
     
    16721672        r->order[0] != ringorder_M)))
    16731673  {
    1674     if ((r->order[1]==ringorder_c)||(r->order[1]==ringorder_C))
    1675     {
    1676       return rOrderType_ExpComp;
     1674    if ((r->order[1] == ringorder_c) || (r->order[1] == ringorder_C))
     1675    {
     1676      switch(r->order[0])
     1677      {
     1678          case ringorder_dp:
     1679          case ringorder_wp:
     1680          case ringorder_ds:
     1681          case ringorder_ws:
     1682          case ringorder_ls:
     1683          case ringorder_unspec:
     1684            if (r->order[1] == ringorder_C ||  r->order[0] == ringorder_unspec)
     1685              return rOrderType_ExpComp;
     1686            return rOrderType_Exp;
     1687       
     1688          default:
     1689            assume(r->order[1] == ringorder_lp ||
     1690                   r->order[1] == ringorder_Dp ||
     1691                   r->order[1] == ringorder_Wp ||
     1692                   r->order[1] == ringorder_Ds ||
     1693                   r->order[1] == ringorder_Ws);
     1694           
     1695            if (r->order[1] == ringorder_c) return rOrderType_ExpComp;
     1696            return rOrderType_Exp;
     1697      }
    16771698    }
    16781699    else
  • Singular/ring.h

    r7f1b91 r18255d  
    77* ABSTRACT - the interpreter related ring operations
    88*/
    9 /* $Id: ring.h,v 1.9 1998-03-16 14:56:41 obachman Exp $ */
     9/* $Id: ring.h,v 1.10 1998-03-19 16:05:51 obachman Exp $ */
    1010
    1111/* includes */
     
    7272  rOrderType_CompExp,     // simple ordering, component has priority
    7373  rOrderType_ExpComp,     // simple ordering, exponent vector has priority
    74   rOrderType_Exp,         // simple ordering, no components involved
     74                          // component not compatible with exp-vector order
     75  rOrderType_Exp,         // simple ordering, exponent vector has priority
     76                          // component is compatible with exp-vector order
    7577  rOrderType_Syz,         // syzygy ordering
    7678  rOrderType_Schreyer     // Schreyer ordering
  • Singular/spSpolyLoop.cc

    r7f1b91 r18255d  
    3131 *
    3232 ***************************************************************/
    33 #if 1
    3433void spSpolyLoop_General
    3534(poly a1, poly a2, poly monom, poly spNoether)
     
    10099   pFree1(b);
    101100}
    102 #else
    103 extern void spGSpolyLoop(poly a1, poly a2, poly m,poly spNoether);
    104 void spSpolyLoop_General
    105 (poly a1, poly a2, poly m,poly spNoether)
    106 {
    107   spGSpolyLoop(a1, a2, m, spNoether);
    108 }
    109 #endif
    110101
    111102
     
    154145  switch (rot)
    155146  {   
    156     rOrderType_Exp:
    157     ot = otEXP;
    158     break;
     147      case rOrderType_Exp:
     148        ot = otEXP;
     149        break;
    159150   
    160     rOrderType_CompExp:
    161     ot = otCOMPEXP;
    162     break;
     151      case rOrderType_CompExp:
     152        ot = otCOMPEXP;
     153        break;
    163154   
    164     rOrderType_ExpComp:
    165     ot = otEXPCOMP;
    166     break;
     155      case rOrderType_ExpComp:
     156        ot = otEXPCOMP;
     157        break;
    167158
    168159      default:
     
    181172  if (Variables1W > 2)
    182173  {
    183     if (Variables1W & 1)
    184       nw = nwODD;
    185     else
    186       nw = nwEVEN;
     174    if (Variables1W & 1) nw = nwODD;
     175    else nw = nwEVEN;
    187176  }
    188177  else
    189178  {
    190     if (Variables1W == 2)
    191       nw = nwTWO;
    192     else
    193       nw = nwONE;
     179    if (Variables1W == 2) nw = nwTWO;
     180    else nw = nwONE;
    194181  }
    195182 
  • Singular/spSpolyLoop.h

    r7f1b91 r18255d  
    2020void spSpolyLoop_General (poly a1, poly a2, poly monom, poly spNoether);
    2121
     22inline spSpolyLoopProc spGetSpolyLoop(ring r, int modrank, int syzComp,
     23                                      BOOLEAN homog)
     24{
     25  return spGetSpolyLoop(r, spGetOrderType(r, modrank, syzComp), homog);
     26}
     27
    2228inline spSpolyLoopProc spGetSpolyLoop(ring r, kStrategy strat)
    2329{
    24   return spGetSpolyLoop(r, spGetOrderType(r, strat), strat->homog);
     30  return spGetSpolyLoop(r, spGetOrderType(r, strat),
     31                        (strat->homog && strat->ak == 0));
    2532}
    2633
  • Singular/spSpolyLoop.pl

    r7f1b91 r18255d  
    11#!/usr/local/bin/perl
    22###########################################################################
    3 # $Id: spSpolyLoop.pl,v 1.1 1998-03-17 10:59:57 obachman Exp $
     3# $Id: spSpolyLoop.pl,v 1.2 1998-03-19 16:05:53 obachman Exp $
    44
    55###########################################################################
     
    240240       c;                                 // used for temporary storage
    241241  number tm   = pGetCoeff(monom),         // coefficient of monom
    242          tneg = CALL_NCOPYNEG(tm), // - (coefficient of monom)
     242         tneg = CALL_NCOPYNEG(tm),        // - (coefficient of monom)
    243243         tb;                              // used for tm*coeff(a1)
    244244
     
    254254
    255255  Equal:   // b equals a2
     256    assume(pComp0(b, a2) == 0);
    256257    tb = CALL_NMULT("pGetCoeff(a1)",tm);
    257258    if (!CALL_NEQUAL("pGetCoeff(a2)",tb))
     
    277278    if (d < 0)  // b < a2:
    278279    {
     280      assume(pComp0(b, a2) == -1);
    279281      a = pNext(a) = a2;// append a2 to result and advance a2
    280282      pIter(a2);
     
    284286    else // now d >= 0, i.e., b > a2
    285287    {
     288      assume(pComp0(b, a2) == 1);
    286289      pSetCoeff0(b,CALL_NMULT("pGetCoeff(a1)",tneg));
    287290      a = pNext(a) = b;       // append b to result and advance a1
     
    294297 
    295298 Finish: // a1 or a2 is NULL: Clean-up time
     299   assume(a1 == NULL || a2 == NULL);
    296300   if (a1 == NULL) // append rest of a2 to result
    297301     pNext(a) = a2;
Note: See TracChangeset for help on using the changeset viewer.