Changeset 8fc5558 in git for Singular/polys-impl.h


Ignore:
Timestamp:
Mar 17, 1998, 11:59:57 AM (26 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.