Changeset 8fc5558 in git


Ignore:
Timestamp:
Mar 17, 1998, 11:59:57 AM (25 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
1e9da80e5772d69c637a702b3937bddd689925a4
Parents:
399efbe1493f787ca072ee4e9b85f144549f7bbc
Message:
* added spSpolyLoop.pl to repository


git-svn-id: file:///usr/local/Singular/svn/trunk@1239 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/Makefile.in

    r399efb r8fc5558  
    294294
    295295distclean: clean
    296         -rm -rf depend iparith.inc mpsr_Tok.inc ${DIST_NAME} ${testdir}/out stamp-h
     296        -rm -rf depend iparith.inc mpsr_Tok.inc spSpolyLoop.inc
     297        -rm -rf ${DIST_NAME} ${testdir}/out stamp-h
    297298        -rm mod2.h Makefile TAGS* config.status config.cache config.log
    298299        cd ${docdir}; ${MAKE} distclean
     
    300301maintainer-clean: distclean
    301302        @echo "This command is intended for maintainers to use;"
    302         @echo "Rebuilding the deleted files requires flex (version 2.3) "
     303        @echo "Rebuilding the deleted files requires flex"
    303304        @echo "bison and autoconf"
    304         -rm configure scanner.cc grammar.h grammar.cc
     305        -rm configure scanner.cc grammar.h grammar.cc libparse.cc
    305306
    306307info dvi ps html:
  • Singular/polys-comp.h

    r399efb r8fc5558  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys-comp.h,v 1.5 1998-03-16 14:56:38 obachman Exp $ */
     6/* $Id: polys-comp.h,v 1.6 1998-03-17 10:59:56 obachman Exp $ */
    77
    88/***************************************************************
     
    1515#include "polys-impl.h"
    1616
    17 #ifdef COMP_FAST
    18 
    19  
    20 
    2117#ifdef WORDS_BIGENDIAN
    22 #ifndef COMP_NO_EXP_VECTOR_OPS
    23 #define _pMonComp_otEXP_nwONE(p1, p2, d, actionD, actionE)              \
     18
     19#define _pMonComp_otEXP_nwONE(p1, p2, d, actionD, actionE)  \
    2420do                                                          \
    2521{                                                           \
     
    3026while(0)
    3127 
    32 #define _pMonComp_otEXPCOMP_nwONE(p1, p2, d, actionD, actionE)            \
    33 do                                                          \
    34 {                                                           \
    35   d = *((long*) &(p1->exp[0])) - *((long*) &(p2->exp[0]));  \
    36   if (d)                                                    \
    37   {                                                         \
    38     if (((long) (pGetComp(p1) - pGetComp(p2))) == d)        \
    39       d = -d;                                               \
    40     actionD;                                                \
    41   }                                                         \
    42   actionE;                                                  \
    43 }                                                           \
    44 while(0)
    45 
    46 #define _pMonComp_otEXP_nwTWO(p1, p2, d, actionD, actionE)  \
    47 do                                              \
    48 {                                               \
    49   const long* s1 = (long*) &(p1->exp[0]);             \
    50   const long* s2 = (long*) &(p2->exp[0]);             \
    51   d = *s1 - *s2;                                \
    52   if (d) actionD;                               \
    53   d = *(s1 + 1) - *(s2 + 1);                    \
    54   if (d) actionD;                               \
    55   actionE;                                      \
    56 }                                               \
    57 while(0)
    58  
    59 #define _pMonComp_otEXPCOMP_nwTWO(p1, p2, d, actionD, actionE)        \
    60 do                                                      \
    61 {                                                       \
    62   const long* s1 = (long*) &(p1->exp[0]);                     \
    63   const long* s2 = (long*) &(p2->exp[0]);                     \
    64   d = *s1 - *s2;                                        \
    65   if (d) actionD;                                       \
    66   d = *(s1 + 1) - *(s2 + 1);                            \
    67   if (d)                                                \
    68   {                                                     \
    69     if (((long) (pGetComp(p1) - pGetComp(p2))) == d)    \
    70       d = -d;                                           \
    71     actionD;                                            \
    72   }                                                     \
    73   actionE;                                              \
    74 }                                                       \
    75 while(0)
    76  
    77 #define _pMonComp_otEXP_nwEVEN(p1, p2, length, d, actionD, actionE) \
    78 do                                                      \
    79 {                                                       \
    80   const long* s1 = (long*) &(p1->exp[0]);                     \
    81   const long* s2 = (long*) &(p2->exp[0]);                     \
    82   const long* const lb = s1 + length;                               \
    83                                                         \
    84   for (;;)                                              \
    85   {                                                     \
    86     d = *s1 - *s2;                                      \
    87     if (d) actionD;                                     \
    88     s1++;                                               \
    89     s2++;                                               \
    90     d = *s1 - *s2;                                      \
    91     if (d) actionD;                                     \
    92     s1++;                                               \
    93     if (s1 == lb) actionE;                              \
    94     s2++;                                               \
    95   }                                                     \
    96 }                                                       \
    97 while(0)
    98 
    99 #define _pMonComp_otEXP_nwODD(p1, p2, length, d, actionD, actionE)   \
    100 do                                                          \
    101 {                                                           \
    102   const long* s1 = (long*) &(p1->exp[0]);                         \
    103   const long* s2 = (long*) &(p2->exp[0]);                         \
    104   const long* const lb = s1 + length;                                   \
    105                                                             \
    106   for (;;)                                                  \
    107   {                                                         \
    108     d = *s1 - *s2;                                          \
    109     if (d) actionD;                                         \
    110     s1++;                                                   \
    111     if (s1 == lb) actionE;                                  \
    112     s2++;                                                   \
    113     d = *s1 - *s2;                                          \
    114     if (d) actionD;                                         \
    115     s1++;                                                   \
    116     s2++;                                                   \
    117   }                                                         \
    118 }                                                           \
    119 while(0)
    120  
    121 #define _pMonComp_otEXPCOMP_nwEVEN(p1, p2, length, d, actionD, actionE)  \
    122 do                                                          \
    123 {                                                           \
    124   const long* s1 = (long*) &(p1->exp[0]);                   \
    125   const long* s2 = (long*) &(p2->exp[0]);                   \
    126   const long* const lb = s1 + length-1;                     \
    127                                                             \
    128   for (;;)                                                  \
    129   {                                                         \
    130     d = *s1 - *s2;                                          \
    131     if (d) actionD;                                         \
    132     s1++;                                                   \
    133     if (s1 == lb) break;                                    \
    134     s2++;                                                   \
    135     d = *s1 - *s2;                                          \
    136     if (d) actionD;                                         \
    137     s1++;                                                   \
    138     s2++;                                                   \
    139   }                                                         \
    140                                                             \
    141   d = *s1 - *(s2 + 1);                                      \
    142   if (d)                                                    \
    143   {                                                         \
    144     if (((long) (pGetComp(p1) - pGetComp(p2))) == d)        \
    145       d = -d;                                               \
    146     actionD;                                                \
    147   }                                                         \
    148   actionE;                                                  \
    149 }                                                           \
    150 while(0)
    151  
    152 #define _pMonComp_otEXPCOMP_nwODD(p1, p2, length, d, actionD, actionE)    \
     28#define _pMonComp_otEXPCOMP_nwONE(p1, p2, d, actionD, actionE)  \
    15329do                                                              \
    15430{                                                               \
    155   const long* s1 = (long*) &(p1->exp[0]);                       \
    156   const long* s2 = (long*) &(p2->exp[0]);                       \
    157   const long* const lb = s1 + length      -1;                   \
    158                                                                 \
    159   for (;;)                                                      \
    160   {                                                             \
    161     d = *s1 - *s2;                                              \
    162     if (d) actionD;                                             \
    163     s1++;                                                       \
    164     s2++;                                                       \
    165     d = *s1 - *s2;                                              \
    166     if (d) actionD;                                             \
    167     s1++;                                                       \
    168     if (s1 == lb) break;                                        \
    169     s2++;                                                       \
    170   }                                                             \
    171                                                                 \
    172   d = *s1 - *(s2 + 1);                                          \
     31  d = *((long*) &(p1->exp[0])) - *((long*) &(p2->exp[0]));      \
    17332  if (d)                                                        \
    17433  {                                                             \
     
    18140while(0)
    18241
    183 #else // COMP_NO_EXP_VECTOR_OPS
    184 
    185 #define _pMonCmp(p1, p2, d, actionD, actionE)   \
    186 do                                              \
    187 {                                               \
    188   Exponent_pt e1 = &(p1->exp[0]);         \
    189   Exponent_pt e2 = &(p2->exp[0]);         \
    190   const Exponent_pt ub = e1 + pVariables; \
    191                                                 \
    192   for (;;)                                      \
    193   {                                             \
    194     d = *e1 - *e2;                              \
    195     if (d) actionD;                             \
    196     e1++;                                       \
    197     if (e1 == ub)                               \
    198     {                                           \
    199       d = pGetComp(p1) - pGetComp(p2);          \
    200       if (d) actionD;                           \
    201       actionE;                                  \
    202     }                                           \
    203     e2++;                                       \
    204   }                                             \
    205 }                                               \
    206 while(0)
    207 
    208 #define _pMonComp_otEXP_c(p1, p2, d, actionD, actionE) \
    209 do                                              \
    210 {                                               \
    211   Exponent_pt e1 = &(p1->exp[0]);         \
    212   Exponent_pt e2 = &(p2->exp[0]);         \
    213   const Exponent_pt ub = e1 + pVariables; \
    214                                                 \
    215   for (;;)                                      \
    216   {                                             \
    217     d = *e1 - *e2;                              \
    218     if (d) actionD;                             \
    219     e1++;                                       \
    220     if (e1 == ub)                               \
    221     {                                           \
    222       d = pGetComp(p2) - pGetComp(p1);          \
    223       if (d) actionD;                           \
    224       actionE;                                  \
    225     }                                           \
    226     e2++;                                       \
    227   }                                             \
    228 }                                               \
    229 while(0)
    230 
    231 #define _pMonComp_otEXP_nwONE(p1, p2, d, actionD, actionE)  \
    232   _pMonCmp(p1, p2, d, actionD, actionE)
    233 
    234 #define _pMonComp_otEXPCOMP_nwONE(p1, p2, d, actionD, actionE)  \
    235   _pMonComp_otEXP_c(p1, p2, d, actionD, actionE)
    236  
    23742#define _pMonComp_otEXP_nwTWO(p1, p2, d, actionD, actionE)  \
    238   _pMonCmp(p1, p2, d, actionD, actionE)
    239 
     43do                                                          \
     44{                                                           \
     45  const long* s1 = (long*) &(p1->exp[0]);                   \
     46  const long* s2 = (long*) &(p2->exp[0]);                   \
     47  d = *s1 - *s2;                                            \
     48  if (d) actionD;                                           \
     49  d = *(s1 + 1) - *(s2 + 1);                                \
     50  if (d) actionD;                                           \
     51  actionE;                                                  \
     52}                                                           \
     53while(0)
     54 
    24055#define _pMonComp_otEXPCOMP_nwTWO(p1, p2, d, actionD, actionE)  \
    241   _pMonComp_otEXP_c(p1, p2, d, actionD, actionE)
     56do                                                              \
     57{                                                               \
     58  const long* s1 = (long*) &(p1->exp[0]);                       \
     59  const long* s2 = (long*) &(p2->exp[0]);                       \
     60  d = *s1 - *s2;                                                \
     61  if (d) actionD;                                               \
     62  d = *(s1 + 1) - *(s2 + 1);                                    \
     63  if (d)                                                        \
     64  {                                                             \
     65    if (((long) (pGetComp(p1) - pGetComp(p2))) == d)            \
     66      d = -d;                                                   \
     67    actionD;                                                    \
     68  }                                                             \
     69  actionE;                                                      \
     70}                                                               \
     71while(0)
    24272 
    24373#define _pMonComp_otEXP_nwEVEN(p1, p2, length, d, actionD, actionE) \
    244   _pMonCmp(p1, p2, d, actionD, actionE)
    245 
    246 #define _pMonComp_otEXP_nwODD(p1, p2, length, d, actionD, actionE) \
    247   _pMonCmp(p1, p2, d, actionD, actionE)
    248 
    249 #define _pMonComp_otEXPCOMP_nwEVEN(p1, p2, length, d, actionD, actionE)   \
    250   _pMonComp_otEXP_c(p1, p2, d, actionD, actionE)
    251 
    252 #define _pMonComp_otEXPCOMP_nwODD(p1, p2, length, d, actionD, actionE) \
    253   _pMonComp_otEXP_c(p1, p2, d, actionD, actionE)
    254 
    255 #endif // COMP_NO_EXP_VECTOR_OPS
     74do                                                                  \
     75{                                                                   \
     76  const long* s1 = (long*) &(p1->exp[0]);                           \
     77  const long* s2 = (long*) &(p2->exp[0]);                           \
     78  const long* const lb = s1 + length;                               \
     79                                                                    \
     80  for (;;)                                                          \
     81  {                                                                 \
     82    d = *s1 - *s2;                                                  \
     83    if (d) actionD;                                                 \
     84    s1++;                                                           \
     85    s2++;                                                           \
     86    d = *s1 - *s2;                                                  \
     87    if (d) actionD;                                                 \
     88    s1++;                                                           \
     89    if (s1 == lb) actionE;                                          \
     90    s2++;                                                           \
     91  }                                                                 \
     92}                                                                   \
     93while(0)
     94
     95#define _pMonComp_otEXP_nwODD(p1, p2, length, d, actionD, actionE)  \
     96do                                                                  \
     97{                                                                   \
     98  const long* s1 = (long*) &(p1->exp[0]);                           \
     99  const long* s2 = (long*) &(p2->exp[0]);                           \
     100  const long* const lb = s1 + length;                               \
     101                                                                    \
     102  for (;;)                                                          \
     103  {                                                                 \
     104    d = *s1 - *s2;                                                  \
     105    if (d) actionD;                                                 \
     106    s1++;                                                           \
     107    if (s1 == lb) actionE;                                          \
     108    s2++;                                                           \
     109    d = *s1 - *s2;                                                  \
     110    if (d) actionD;                                                 \
     111    s1++;                                                           \
     112    s2++;                                                           \
     113  }                                                                 \
     114}                                                                   \
     115while(0)
     116 
     117#define _pMonComp_otEXPCOMP_nwEVEN(p1, p2, length, d, actionD, actionE) \
     118do                                                                      \
     119{                                                                       \
     120  const long* s1 = (long*) &(p1->exp[0]);                               \
     121  const long* s2 = (long*) &(p2->exp[0]);                               \
     122  const long* const lb = s1 + length-1;                                 \
     123                                                                        \
     124  for (;;)                                                              \
     125  {                                                                     \
     126    d = *s1 - *s2;                                                      \
     127    if (d) actionD;                                                     \
     128    s1++;                                                               \
     129    if (s1 == lb) break;                                                \
     130    s2++;                                                               \
     131    d = *s1 - *s2;                                                      \
     132    if (d) actionD;                                                     \
     133    s1++;                                                               \
     134    s2++;                                                               \
     135  }                                                                     \
     136                                                                        \
     137  d = *s1 - *(s2 + 1);                                                  \
     138  if (d)                                                                \
     139  {                                                                     \
     140    if (((long) (pGetComp(p1) - pGetComp(p2))) == d)                    \
     141      d = -d;                                                           \
     142    actionD;                                                            \
     143  }                                                                     \
     144  actionE;                                                              \
     145}                                                                       \
     146while(0)
     147 
     148#define _pMonComp_otEXPCOMP_nwODD(p1, p2, length, d, actionD, actionE)  \
     149do                                                                      \
     150{                                                                       \
     151  const long* s1 = (long*) &(p1->exp[0]);                               \
     152  const long* s2 = (long*) &(p2->exp[0]);                               \
     153  const long* const lb = s1 + length      -1;                           \
     154                                                                        \
     155  for (;;)                                                              \
     156  {                                                                     \
     157    d = *s1 - *s2;                                                      \
     158    if (d) actionD;                                                     \
     159    s1++;                                                               \
     160    s2++;                                                               \
     161    d = *s1 - *s2;                                                      \
     162    if (d) actionD;                                                     \
     163    s1++;                                                               \
     164    if (s1 == lb) break;                                                \
     165    s2++;                                                               \
     166  }                                                                     \
     167                                                                        \
     168  d = *s1 - *(s2 + 1);                                                  \
     169  if (d)                                                                \
     170  {                                                                     \
     171    if (((long) (pGetComp(p1) - pGetComp(p2))) == d)                    \
     172      d = -d;                                                           \
     173    actionD;                                                            \
     174  }                                                                     \
     175  actionE;                                                              \
     176}                                                                       \
     177while(0)
    256178
    257179#else //  ! WORDS_BIGENDIAN
    258180
    259 #ifndef COMP_NO_EXP_VECTOR_OPS 
    260 #define _pMonComp_otEXP_nwONE(p1, p2, d, actionD, actionE)                              \
     181#define _pMonComp_otEXP_nwONE(p1, p2, d, actionD, actionE)                  \
    261182do                                                                          \
    262183{                                                                           \
     
    267188while(0)
    268189 
    269 #define _pMonComp_otEXPCOMP_nwONE(p1, p2, d, actionD, actionE)                            \
     190#define _pMonComp_otEXPCOMP_nwONE(p1, p2, d, actionD, actionE)              \
    270191do                                                                          \
    271192{                                                                           \
     
    282203
    283204#define _pMonComp_otEXP_nwTWO(p1, p2, d, actionD, actionE)  \
    284 do                                              \
    285 {                                               \
    286   const long* s1 = ((long*) p1) + pMonomSizeW-1;      \
    287   const long* s2 = ((long*) p2)  + pMonomSizeW-1;      \
    288   d = *s1 - *s2;                                \
    289   if (d) actionD;                               \
    290   d = *(s1 - 1) - *(s2 - 1);                    \
    291   if (d) actionD;                               \
    292   actionE;                                      \
    293 }                                               \
    294 while(0)
    295  
    296 #define _pMonComp_otEXPCOMP_nwTWO(p1, p2, d, actionD, actionE)        \
    297 do                                                      \
    298 {                                                       \
    299   const long* s1 = ((long*) p1) + pMonomSizeW-1;              \
    300   const long* s2 = ((long*) p2)  + pMonomSizeW-1;             \
    301   d = *s1 - *s2;                                        \
    302   if (d) actionD;                                       \
    303   d = *s1 - *s2;                                        \
    304   if (d) actionD;                                       \
    305   d = *(s1 -1) - *(s2 -1);                              \
    306   if (d)                                                \
    307   {                                                     \
    308     if (((long) (pGetComp(p1) - pGetComp(p2))) == d)    \
    309       d = -d;                                           \
    310     actionD;                                            \
    311   }                                                     \
    312   actionE;                                              \
    313 }                                                       \
    314 while(0)
    315  
    316 #define _pMonComp_otEXP_nwEVEN(p1, p2, length, d, actionD, actionE) \
    317 do                                                      \
    318 {                                                       \
    319   const long* s1 = ((long*) p1) + pMonomSizeW-1;              \
    320   const long* s2 = ((long*) p2)  + pMonomSizeW-1;             \
    321   const long* const lb = s1 - length;                                \
    322   for (;;)                                              \
    323   {                                                     \
    324     d = *s1 - *s2;                                      \
    325     if (d) actionD;                                     \
    326     s1--;                                               \
    327     s2--;                                               \
    328     d = *s1 - *s2;                                      \
    329     if (d) actionD;                                     \
    330     s1--;                                               \
    331     if (s1 == lb) actionE;                              \
    332     s2--;                                               \
    333   }                                                     \
    334 }                                                       \
    335 while(0)
    336 
    337 #define _pMonComp_otEXP_nwODD(p1, p2, length, d, actionD, actionE)   \
    338205do                                                          \
    339206{                                                           \
    340   const long* s1 = ((long*) p1) + pMonomSizeW-1;                  \
    341   const long* s2 = ((long*) p2)  + pMonomSizeW-1;                 \
    342   const long* const lb = s1 - length;                                    \
    343                                                             \
    344   for (;;)                                                  \
    345   {                                                         \
    346     d = *s1 - *s2;                                          \
    347     if (d) actionD;                                         \
    348     s1--;                                                   \
    349     if (s1 == lb) actionE;                                  \
    350     s2--;                                                   \
    351     d = *s1 - *s2;                                          \
    352     if (d) actionD;                                         \
    353     s1--;                                                   \
    354     s2--;                                                   \
    355   }                                                         \
    356 }                                                           \
    357 while(0)
    358  
    359 #define _pMonComp_otEXPCOMP_nwEVEN(p1, p2, length, d, actionD, actionE)   \
    360 do                                                          \
    361 {                                                           \
    362   const long* s1 = ((long*) p1) + pMonomSizeW-1;                  \
    363   const long* s2 = ((long*) p2)  + pMonomSizeW-1;                 \
    364   const long* const lb = s1 - length +1;                                 \
    365                                                             \
    366   for (;;)                                                  \
    367   {                                                         \
    368     d = *s1 - *s2;                                          \
    369     if (d) actionD;                                         \
    370     s1--;                                                   \
    371     if (s1 == lb) break;                                    \
    372     s2--;                                                   \
    373     d = *s1 - *s2;                                          \
    374     if (d) actionD;                                         \
    375     s1--;                                                   \
    376     s2--;                                                   \
    377   }                                                         \
    378                                                             \
    379   d = *s1 - *(s2 - 1);                                      \
    380   if (d)                                                    \
    381   {                                                         \
    382     if (((long) (pGetComp(p1) - pGetComp(p2))) == d)        \
    383       d = -d;                                               \
    384     actionD;                                                \
    385   }                                                         \
     207  const long* s1 = ((long*) p1) + pMonomSizeW-1;            \
     208  const long* s2 = ((long*) p2)  + pMonomSizeW-1;           \
     209  d = *s1 - *s2;                                            \
     210  if (d) actionD;                                           \
     211  d = *(s1 - 1) - *(s2 - 1);                                \
     212  if (d) actionD;                                           \
    386213  actionE;                                                  \
    387214}                                                           \
    388215while(0)
    389216 
    390 #define _pMonComp_otEXPCOMP_nwODD(p1, p2, length, d, actionD, actionE) \
    391 do                                                          \
    392 {                                                           \
    393   const long* s1 = ((long*) p1) + pMonomSizeW-1;                  \
    394   const long* s2 = ((long*) p2)  + pMonomSizeW-1;                 \
    395   const long* const lb = s1 - length +1;                                 \
    396                                                             \
    397   for (;;)                                                  \
    398   {                                                         \
    399     d = *s1 - *s2;                                          \
    400     if (d) actionD;                                         \
    401     s1--;                                                   \
    402     s2--;                                                   \
    403     d = *s1 - *s2;                                          \
    404     if (d) actionD;                                         \
    405     s1--;                                                   \
    406     if (s1 == lb) break;                                    \
    407     s2--;                                                   \
    408   }                                                         \
    409                                                             \
    410   d = *s1 - *(s2 - 1);                                      \
    411   if (d)                                                    \
    412   {                                                         \
    413     if (((long) (pGetComp(p1) - pGetComp(p2))) == d)        \
    414       d = -d;                                               \
    415     actionD;                                                \
    416   }                                                         \
    417   actionE;                                                  \
    418 }                                                           \
    419 while(0)
    420 
    421 #else // COMP_NO_EXP_VECTOR_OPS
    422 
    423 #define _pMonCmp(p1, p2, d, actionD, actionE)   \
    424 do                                              \
    425 {                                               \
    426   Exponent_pt e1 = &(p1->exp[pVarHighIndex]);   \
    427   Exponent_pt e2 = &(p2->exp[pVarHighIndex]);   \
    428   const Exponent_pt ub = e1 - pVariables;       \
    429                                                 \
    430   for (;;)                                      \
    431   {                                             \
    432     d = *e1 - *e2;                              \
    433     if (d) actionD;                             \
    434     e1--;                                       \
    435     if (e1 == ub)                               \
    436     {                                           \
    437       d = pGetComp(p1) - pGetComp(p2);          \
    438       if (d) actionD;                           \
    439       actionE;                                  \
    440     }                                           \
    441     e2--;                                       \
    442   }                                             \
    443 }                                               \
    444 while(0)
    445 
    446 #define _pMonComp_otEXP_c(p1, p2, d, actionD, actionE) \
    447 do                                              \
    448 {                                               \
    449   Exponent_pt e1 = &(p1->exp[pVarHighIndex]);   \
    450   Exponent_pt e2 = &(p2->exp[pVarHighIndex]);   \
    451   const Exponent_pt ub = e1 - pVariables;       \
    452                                                 \
    453   for (;;)                                      \
    454   {                                             \
    455     d = *e1 - *e2;                              \
    456     if (d) actionD;                             \
    457     e1--;                                       \
    458     if (e1 == ub)                               \
    459     {                                           \
    460       d = pGetComp(p2) - pGetComp(p1);          \
    461       if (d) actionD;                           \
    462       actionE;                                  \
    463     }                                           \
    464     e2--;                                       \
    465   }                                             \
    466 }                                               \
    467 while(0)
    468 
    469 #define _pMonComp_otEXP_nwONE(p1, p2, d, actionD, actionE)  \
    470   _pMonCmp(p1, p2, d, actionD, actionE)
    471 
    472 #define _pMonComp_otEXPCOMP_nwONE(p1, p2, d, actionD, actionE)  \
    473   _pMonComp_otEXP_c(p1, p2, d, actionD, actionE)
    474  
    475 #define _pMonComp_otEXP_nwTWO(p1, p2, d, actionD, actionE)  \
    476   _pMonCmp(p1, p2, d, actionD, actionE)
    477 
    478217#define _pMonComp_otEXPCOMP_nwTWO(p1, p2, d, actionD, actionE)  \
    479   _pMonComp_otEXP_c(p1, p2, d, actionD, actionE)
     218do                                                              \
     219{                                                               \
     220  const long* s1 = ((long*) p1) + pMonomSizeW-1;                \
     221  const long* s2 = ((long*) p2)  + pMonomSizeW-1;               \
     222  d = *s1 - *s2;                                                \
     223  if (d) actionD;                                               \
     224  d = *s1 - *s2;                                                \
     225  if (d) actionD;                                               \
     226  d = *(s1 -1) - *(s2 -1);                                      \
     227  if (d)                                                        \
     228  {                                                             \
     229    if (((long) (pGetComp(p1) - pGetComp(p2))) == d)            \
     230      d = -d;                                                   \
     231    actionD;                                                    \
     232  }                                                             \
     233  actionE;                                                      \
     234}                                                               \
     235while(0)
    480236 
    481237#define _pMonComp_otEXP_nwEVEN(p1, p2, length, d, actionD, actionE) \
    482   _pMonCmp(p1, p2, d, actionD, actionE)
    483 
    484 #define _pMonComp_otEXP_nwODD(p1, p2, length, d, actionD, actionE) \
    485   _pMonCmp(p1, p2, d, actionD, actionE)
    486 
    487 #define _pMonComp_otEXPCOMP_nwEVEN(p1, p2, length, d, actionD, actionE)   \
    488   _pMonComp_otEXP_c(p1, p2, d, actionD, actionE)
    489 
    490 #define _pMonComp_otEXPCOMP_nwODD(p1, p2, length, d, actionD, actionE) \
    491   _pMonComp_otEXP_c(p1, p2, d, actionD, actionE)
    492  
    493 #endif // COMP_NO_EXP_VECTOR_OPS
    494  
     238do                                                                  \
     239{                                                                   \
     240  const long* s1 = ((long*) p1) + pMonomSizeW-1;                    \
     241  const long* s2 = ((long*) p2)  + pMonomSizeW-1;                   \
     242  const long* const lb = s1 - length;                               \
     243  for (;;)                                                          \
     244  {                                                                 \
     245    d = *s1 - *s2;                                                  \
     246    if (d) actionD;                                                 \
     247    s1--;                                                           \
     248    s2--;                                                           \
     249    d = *s1 - *s2;                                                  \
     250    if (d) actionD;                                                 \
     251    s1--;                                                           \
     252    if (s1 == lb) actionE;                                          \
     253    s2--;                                                           \
     254  }                                                                 \
     255}                                                                   \
     256while(0)
     257
     258#define _pMonComp_otEXP_nwODD(p1, p2, length, d, actionD, actionE)  \
     259do                                                                  \
     260{                                                                   \
     261  const long* s1 = ((long*) p1) + pMonomSizeW-1;                    \
     262  const long* s2 = ((long*) p2)  + pMonomSizeW-1;                   \
     263  const long* const lb = s1 - length;                               \
     264                                                                    \
     265  for (;;)                                                          \
     266  {                                                                 \
     267    d = *s1 - *s2;                                                  \
     268    if (d) actionD;                                                 \
     269    s1--;                                                           \
     270    if (s1 == lb) actionE;                                          \
     271    s2--;                                                           \
     272    d = *s1 - *s2;                                                  \
     273    if (d) actionD;                                                 \
     274    s1--;                                                           \
     275    s2--;                                                           \
     276  }                                                                 \
     277}                                                                   \
     278while(0)
     279 
     280#define _pMonComp_otEXPCOMP_nwEVEN(p1, p2, length, d, actionD, actionE) \
     281do                                                                      \
     282{                                                                       \
     283  const long* s1 = ((long*) p1) + pMonomSizeW-1;                        \
     284  const long* s2 = ((long*) p2)  + pMonomSizeW-1;                       \
     285  const long* const lb = s1 - length +1;                                \
     286                                                                        \
     287  for (;;)                                                              \
     288  {                                                                     \
     289    d = *s1 - *s2;                                                      \
     290    if (d) actionD;                                                     \
     291    s1--;                                                               \
     292    if (s1 == lb) break;                                                \
     293    s2--;                                                               \
     294    d = *s1 - *s2;                                                      \
     295    if (d) actionD;                                                     \
     296    s1--;                                                               \
     297    s2--;                                                               \
     298  }                                                                     \
     299                                                                        \
     300  d = *s1 - *(s2 - 1);                                                  \
     301  if (d)                                                                \
     302  {                                                                     \
     303    if (((long) (pGetComp(p1) - pGetComp(p2))) == d)                    \
     304      d = -d;                                                           \
     305    actionD;                                                            \
     306  }                                                                     \
     307  actionE;                                                              \
     308}                                                                       \
     309while(0)
     310 
     311#define _pMonComp_otEXPCOMP_nwODD(p1, p2, length, d, actionD, actionE)  \
     312do                                                                      \
     313{                                                                       \
     314  const long* s1 = ((long*) p1) + pMonomSizeW-1;                        \
     315  const long* s2 = ((long*) p2)  + pMonomSizeW-1;                       \
     316  const long* const lb = s1 - length +1;                                \
     317                                                                        \
     318  for (;;)                                                              \
     319  {                                                                     \
     320    d = *s1 - *s2;                                                      \
     321    if (d) actionD;                                                     \
     322    s1--;                                                               \
     323    s2--;                                                               \
     324    d = *s1 - *s2;                                                      \
     325    if (d) actionD;                                                     \
     326    s1--;                                                               \
     327    if (s1 == lb) break;                                                \
     328    s2--;                                                               \
     329  }                                                                     \
     330                                                                        \
     331  d = *s1 - *(s2 - 1);                                                  \
     332  if (d)                                                                \
     333  {                                                                     \
     334    if (((long) (pGetComp(p1) - pGetComp(p2))) == d)                    \
     335      d = -d;                                                           \
     336    actionD;                                                            \
     337  }                                                                     \
     338  actionE;                                                              \
     339}                                                                       \
     340while(0)
     341
    495342#endif // WORDS_BIGENDIAN
    496343
    497 #endif // COMP_FAST
    498 
    499344#endif // POLYS_COMP_H
    500345
  • Singular/polys-impl.h

    r399efb r8fc5558  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys-impl.h,v 1.18 1998-03-16 14:56:38 obachman Exp $ */
     6/* $Id: polys-impl.h,v 1.19 1998-03-17 10:59:57 obachman Exp $ */
    77
    88/***************************************************************
     
    1919#include "structs.h"
    2020#include "mmemory.h"
    21 #include "binom.h"
    2221
    2322/***************************************************************
     
    3635
    3736typedef long Order_t;
    38 // make sure that exp is aligned
    3937struct  spolyrec
    4038{
     
    4240  number    coef;
    4341  Order_t   Order;
    44   #ifdef TEST_MAC_DEBUG
    45   Order_t   MOrder;
    46   #endif
    47   monomial  exp;
     42  monomial  exp; // make sure that exp is aligned
    4843};
    4944
     45
    5046/***************************************************************
    51  * MACROS CONTROLING MONOMIAL COMPARIONS:
    52 
    53  * COMP_TRADITIONAL
    54      Keeps the traditional comparison routines
    55      defined -- needed as long as their might be comparisons with
    56      negativ components.
    57      All the traditional routines are prefixed by t_
    58 
    59  * COMP_FAST
    60      Implements monomial operations using the fast vector
    61      techniques and several other extensions which go along with that.
    62      Undefine in case there are problems.
    63 
    64  * COMP_STATISTIC
    65      Provides several routines for accumulating statistics on monomial
    66      comparisons and divisibility tests
    67 
    68  * COMP_DEBUG
    69      Turns on debugging of COMP_FAST by comparing the results of fast
    70      comparison with traditional comparison
    71 
    72  * COMP_NO_EXP_VECTOR_OPS
    73     Like COMP_FAST, except that it turns off "vector techniques" of
    74     monomial operations, i.e. does everything exponent-wise.
     47 *
     48 * variables/defines used for managment of monomials
     49 *
    7550 ***************************************************************/
    76 #define COMP_FAST
    77 // #define COMP_DEBUG
    78 // #define COMP_NO_EXP_VECTOR_OPS
    79 #define COMP_TRADITIONAL
    80 
    81 #if defined(COMP_NO_EXP_VECTOR_OPS) && ! defined(COMP_FAST)
    82 #define COMP_FAST
    83 #endif
    84 
    85 #if defined(COMP_FAST) && ! defined(NDEBUG)
    86 #define COMP_DEBUG
    87 #endif
    88 
    89 // some relations between these flags
    90 #ifdef COMP_DEBUG
    91 #define COMP_TRADITIONAL
    92 #define COMP_FAST
    93 #undef  COMP_PROFILE
    94 #undef  COMP_STATISTICS
    95 #endif // COMP_DEBUG
    96 
    97 #ifdef COMP_STATISTICS
    98 #undef COMP_FAST
    99 #endif // COMP_STATISTICS
    100 
    101 // for the time being COMP_TRADITIONAL always has to be defined, since
    102 // traditional routines are needed in spolys.cc -- monomials with
    103 // negative exponents are compared there!
    104 #define COMP_TRADITIONAL
    105 
    106 /***************************************************************
    107  *
    108  * variables used for storage management and monomial traversions
    109  *
    110  ***************************************************************/
    111 
    112 // size of poly without exponents
    113 #ifdef TEST_MAC_DEBUG
    114 #define POLYSIZE (sizeof(poly) + sizeof(number) + 2*sizeof(Order_t))
    115 #else
     51
    11652#define POLYSIZE (sizeof(poly) + sizeof(number) + sizeof(Order_t))
    117 #endif
    11853#define POLYSIZEW (POLYSIZE / sizeof(long))
    11954// number of Variables
     
    12358// size of a monom in units of sizeof(void*) -- i.e. in words
    12459extern int pMonomSizeW;
    125 #ifdef COMP_FAST
    12660// Ceiling((pVariables+1) / sizeof(void*)) == length of exp-vector in words
    12761extern int pVariables1W;
    12862// Ceiling((pVariables) / sizeof(void*))
    12963extern int pVariablesW;
    130 extern int pCompIndex;
    13164extern int pVarOffset;
    13265extern int pVarLowIndex;
    13366extern int pVarHighIndex;
    134 #else
    135 #define pCompIndex 0
    136 #endif
    13767
    13868/***************************************************************
     
    14676//
    14777// BIGENDIAN -- lex order
    148 // e_1, e_2, ... , e_n,..,comp : pVarOffset = -1,
    149 //                               pCompIndex = pVariables + #(..)
     78// e_1, e_2, ... , e_n,comp,.. : pVarOffset = -1,
    15079//                               pVarLowIndex = 0,
    15180//                               pVarHighIndex = pVariables-1
     81//                               P_COMP_INDEX = pVariables
    15282// BIGENDIAN -- rev lex order
    153 // e_n, ... , e_2, e_1,..,comp : pVarOffset = pVariables,
    154 //                               pCompIndex = pVariables + #(..)
     83// e_n, ... , e_2, e_1,comp,.. : pVarOffset = pVariables,
    15584//                               pVarLowIndex = 0,
    15685//                               pVarHighIndex = pVariables-1
     86//                               P_COMP_INDEX = pVariables
    15787// LITTLEENDIAN -- rev lex order
    15888// comp,.., e_1, e_2, ... , e_n : pVarOffset = #(..),
    159 //                                pCompIndex = 0,
    16089//                                pVarLowIndex = 1 + #(..),
    16190//                                pVarHighIndex = #(..) + pVariables
     91//                                P_COMP_INDEX = pVariables
    16292// LITTLEENDIAN -- lex order
    16393// comp,..,e_n, .... , e_2, e_1 : pVarOffset = pVariables + 1 + #(..)
    164 //                                pCompIndex = 0
    16594//                                pVarLowIndex = 1 + #(..)
    16695//                                pVarHighIndex = #(..) + pVariables
     96//                                P_COMP_INDEX = pVariables
    16797//
    16898// Furthermore, the size of the exponent vector is always a multiple
     
    170100// filled in between comp and first/last exponent -- i.e. comp and
    171101// first/last exponent might not be next to each other
    172 
    173 #ifdef COMP_FAST
    174102
    175103#ifdef WORDS_BIGENDIAN
     
    193121#endif // WORDS_BIGENDIAN
    194122
    195 inline void pGetVarIndicies_Lex(int nvars,
    196                                 int &VarOffset, int &VarCompIndex,
     123inline void pGetVarIndicies_Lex(int nvars, int &VarOffset,
    197124                                int &VarLowIndex, int &VarHighIndex)
    198125{
     126#ifdef WORDS_BIGENDIAN
     127  VarOffset    = -1;
     128  VarLowIndex  = 0;
     129  VarHighIndex = nvars - 1;
     130#else //  ! WORDS_BIGENDIAN
    199131  long temp = (nvars+1)*sizeof(Exponent_t);
    200132  if ((temp % sizeof(long)) == 0)
     
    202134  else
    203135    temp = (temp / sizeof(long)) + 1; // now temp == nvars1W
     136  VarHighIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1;
     137  VarLowIndex  = VarHighIndex - nvars + 1;
     138  VarOffset    = VarHighIndex + 1;
     139#endif // WORDS_BIGENDIAN
     140}
     141
     142#define pSetVarIndicies_Lex(nvars) \
     143  pGetVarIndicies_Lex(nvars,pVarOffset,pVarLowIndex,pVarHighIndex)
     144 
     145
     146inline void pGetVarIndicies_RevLex(int nvars, int &VarOffset,
     147                                   int &VarLowIndex, int &VarHighIndex)
     148{
    204149#ifdef WORDS_BIGENDIAN
    205   VarCompIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1;
    206   VarOffset    = -1;
     150  VarOffset    = nvars;
    207151  VarLowIndex  = 0;
    208   VarHighIndex = nvars - 1;
     152  VarHighIndex = nvars-1;
    209153#else //  ! WORDS_BIGENDIAN
    210   VarHighIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1;
    211   VarCompIndex = 0;
    212   VarOffset    = VarHighIndex + 1;
    213   VarLowIndex  = VarOffset - nvars;
    214 #endif // WORDS_BIGENDIAN
    215 }
    216 #define pSetVarIndicies_Lex(nvars) \
    217   pGetVarIndicies_Lex(nvars,pVarOffset,pCompIndex,pVarLowIndex,pVarHighIndex)
    218 
    219 inline void pGetVarIndicies_RevLex(int nvars,
    220                                    int &VarOffset, int &VarCompIndex,
    221                                    int &VarLowIndex, int &VarHighIndex)
    222 {
    223154  long temp = (nvars+1)*sizeof(Exponent_t);
    224155  if ((temp % sizeof(long)) == 0)
     
    226157  else
    227158    temp = (temp / sizeof(long)) + 1;
    228 #ifdef WORDS_BIGENDIAN
    229   VarCompIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1;
    230   VarOffset    = nvars;
    231   VarLowIndex  = 0;
    232   VarHighIndex = nvars-1;
    233 #else //  ! WORDS_BIGENDIAN
    234   // comp, ..., e_1, e_2, ... , e_n
    235159  VarHighIndex = temp * sizeof(long)/sizeof(Exponent_t) - 1;
    236   VarCompIndex = 0;
    237160  VarLowIndex  = VarHighIndex - nvars + 1;
    238161  VarOffset    = VarLowIndex - 1;
    239162#endif // WORDS_BIGENDIAN
    240163}
     164#ifdef WORDS_BIGENDIAN
    241165#define pSetVarIndicies_RevLex(nvars) \
    242166 pGetVarIndicies_RevLex(nvars,pVarOffset,pCompIndex,pVarLowIndex,pVarHighIndex)
     167#else
     168#define pSetVarIndicies_RevLex(nvars) \
     169 pGetVarIndicies_RevLex(nvars,pVarOffset,pVarLowIndex, pVarLowIndex,pVarHighIndex)
     170#endif
    243171
    244172// The default settings:
Note: See TracChangeset for help on using the changeset viewer.