Changeset eb17bd3 in git for Singular/polys-impl.h


Ignore:
Timestamp:
Jan 16, 1998, 9:24:06 AM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
0d17129ea525ee2de2129263e6772861595d5a12
Parents:
51bfdb771330882f5a7a80691361ef0ec98f7cbe
Message:
* hannes: changes for TEST_MAC_ORDER
    (binom.cc binom.h polys-impl.cc polys-impl.h polys.cc
    spSpolyLoop.cc spolys0.h)


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

Legend:

Unmodified
Added
Removed
  • Singular/polys-impl.h

    r51bfdb reb17bd3  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys-impl.h,v 1.11 1998-01-15 16:16:23 obachman Exp $ */
     6/* $Id: polys-impl.h,v 1.12 1998-01-16 08:24:03 Singular Exp $ */
    77
    88/***************************************************************
     
    2626 ***************************************************************/
    2727
    28 // EXPONENT_TYPE is determined by configure und defined in mod2.h 
     28// EXPONENT_TYPE is determined by configure und defined in mod2.h
    2929typedef EXPONENT_TYPE Exponent_t;
    3030
     
    4141  number    coef;
    4242  Order_t   Order;
     43  #ifdef TEST_MAC_DEBUG
     44  Order_t   MOrder;
     45  #endif
    4346  monomial  exp;
    4447};
     
    4750 * MACROS CONTROLING MONOMIAL COMPARIONS:
    4851
    49  * COMP_TRADITIONAL 
     52 * COMP_TRADITIONAL
    5053     Keeps the traditional comparison routines
    5154     defined -- needed as long as their might be comparisons with
    5255     negativ components.
    5356     All the traditional routines are prefixed by t_
    54      
    55  * COMP_FAST 
     57
     58 * COMP_FAST
    5659     Implements monomial operations using the fast vector
    5760     techniques and several other extensions which go along with that.
    58      Undefine in case there are problems. 
    59      
    60  * COMP_STATISTIC 
     61     Undefine in case there are problems.
     62
     63 * COMP_STATISTIC
    6164     Provides several routines for accumulating statistics on monomial
    6265     comparisons and divisibility tests
    63      
    64  * COMP_DEBUG 
     66
     67 * COMP_DEBUG
    6568     Turns on debugging of COMP_FAST by comparing the results of fast
    6669     comparison with traditional comparison
     
    6871 * COMP_NO_EXP_VECTOR_OPS
    6972    Like COMP_FAST, except that it turns off "vector techniques" of
    70     monomial operations, i.e. does everything exponent-wise. 
     73    monomial operations, i.e. does everything exponent-wise.
    7174 ***************************************************************/
    7275// #define COMP_FAST
     
    107110
    108111// size of poly without exponents
     112#ifdef TEST_MAC_DEBUG
     113#define POLYSIZE (sizeof(poly) + sizeof(number) + 2*sizeof(Order_t))
     114#else
    109115#define POLYSIZE (sizeof(poly) + sizeof(number) + sizeof(Order_t))
     116#endif
    110117#define POLYSIZEW (POLYSIZE / sizeof(long))
    111118// number of Variables
     
    171178  (pVarOffset == -1 ? (i) - 1 : pVarOffset - (i))
    172179#define _pRingExpIndex(r, i)                           \
    173   ((r)->VarOffset == -1 ? (i) - 1 : (r)->VarOffset - (i))   
     180  ((r)->VarOffset == -1 ? (i) - 1 : (r)->VarOffset - (i))
    174181
    175182#else // ! WORDS_BIGENDIAN
     
    184191
    185192#endif // WORDS_BIGENDIAN
    186    
     193
    187194inline void pGetVarIndicies_Lex(int nvars,
    188195                                int &VarOffset, int &VarCompIndex,
     
    235242
    236243// The default settings:
    237 inline void pGetVarIndicies(int nvars, 
     244inline void pGetVarIndicies(int nvars,
    238245                            int &VarOffset, int &VarCompIndex,
    239246                            int &VarLowIndex, int &VarHighIndex)
    240 {   
     247{
    241248  pGetVarIndicies_Lex(nvars,VarOffset,VarCompIndex,VarLowIndex,VarHighIndex);
    242249}
     
    250257  pGetVarIndicies(nvars, pVarOffset, pCompIndex, pVarLowIndex, pVarHighIndex)
    251258
    252    
     259
    253260#else  // ! COMP_FAST
    254261#define _pExpIndex(i)       (i)
    255 #define _pRingExpIndex(r,i) (i)   
     262#define _pRingExpIndex(r,i) (i)
    256263#endif // COMP_FAST
    257264
    258265/***************************************************************
    259266 *
    260  * Primitives for accessing and seeting fields of a poly 
     267 * Primitives for accessing and seeting fields of a poly
    261268 *
    262269 ***************************************************************/
     
    376383#define _pHead(A)       pDBHead(A,__FILE__,__LINE__)
    377384#define _pHead0(A)      pDBHead0(A, __FILE__,__LINE__)
    378 #ifdef COMP_FAST 
     385#ifdef COMP_FAST
    379386#define _pFetchCopy(r,A)    pDBFetchCopy(r, A,__FILE__,__LINE__)
    380387#else
    381388#define _pFetchCopy(r,p)    pOrdPolyInsertSetm(pCopy(p))
    382389#endif
    383  
     390
    384391#else // ! MDEBUG
    385392
     
    388395
    389396#include <string.h>
    390  
     397
    391398inline poly    _pInit(void)
    392399{
     
    419426#ifdef DO_PROFILE
    420427
    421 #ifndef POLYS_IMPL_CC 
     428#ifndef POLYS_IMPL_CC
    422429#define DECLARE(type, arglist) type arglist; \
    423430   static type dummy_##arglist
    424431#else
    425 #define DECLARE(type, arglist) type arglist 
     432#define DECLARE(type, arglist) type arglist
    426433#endif // POLYS_IMPL_CC
    427434
    428435#else //! DO_PROFILE
    429436
    430 #define DECLARE(type, arglist ) inline type arglist 
    431 
    432 #endif // DO_PROFILE 
     437#define DECLARE(type, arglist ) inline type arglist
     438
     439#endif // DO_PROFILE
    433440
    434441
     
    440447
    441448#ifdef COMP_FAST
    442  
    443 // nice declaration isn't it ?? 
     449
     450// nice declaration isn't it ??
    444451#if defined(PDEBUG) && PDEBUG == 1
    445452#define pMonAddFast(p1, p2)  pDBMonAddFast(p1, p2, __FILE__, __LINE__)
     
    454461  // positive and the sum of two exponents does not exceed
    455462  // EXPONENT_MAX
    456 #ifndef COMP_NO_EXP_VECTOR_OPS 
     463#ifndef COMP_NO_EXP_VECTOR_OPS
    457464  Exponent_t c2 = _pGetComp(p2);
    458465  int i = pVariables1W;
     
    466473  Exponent_pt s2 = &(p2->exp[pVarLowIndex]);
    467474#endif
    468  
     475
    469476  for (;;)
    470477  {
     
    478485  // reset comp of p2
    479486  _pSetComp(p2, c2);
    480 #endif 
     487#endif
     488#ifdef TEST_MAC_ORDER
     489  if (bNoAdd) bSetm(p1);else
     490#endif
    481491  _pGetOrder(p1) += _pGetOrder(p2);
    482492}
     
    504514  const Exponent_t* s3 = (Exponent_t*) &(p3->exp[pVarLowIndex]);
    505515  const Exponent_t* const ub = s3 + pVariables;
    506 // need to zero the "fill in" slots (i.e., empty exponents) 
     516// need to zero the "fill in" slots (i.e., empty exponents)
    507517#ifdef  WORDS_BIG_ENDIAN
    508518  *((unsigned long*) p1 + pMonomSize -1) = 0;
    509519#else
    510520  *((unsigned long *) p1->exp) = 0;
    511 #endif 
    512 #endif 
    513  
     521#endif
     522#endif
     523
    514524  for (;;)
    515525  {
     
    523533  // component of p1 is set to comp of p2
    524534  _pSetComp(p1, _pGetComp(p2));
     535  #ifdef TEST_MAC_ORDER
     536  if (bNoAdd) bSetm(p1);else
     537  #endif
    525538  _pGetOrder(p1) = _pGetOrder(p2) + _pGetOrder(p3);
    526539}
    527540
    528541// Similar to pCopyAddFast, except that we assume that the component
    529 // of p2 and p3 is zero component 
     542// of p2 and p3 is zero component
    530543#if defined(PDEBUG) && PDEBUG == 1
    531544#define _pCopyAddFast1(p1, p2, p3)  pDBCopyAddFast(p1, p2, p3, __FILE__, __LINE__)
     
    553566#else
    554567  *((unsigned long *) p1->exp) = 0;
    555 #endif 
    556 #endif 
     568#endif
     569#endif
    557570
    558571  for (;;)
     
    564577    s2++;
    565578  }
     579  #ifdef TEST_MAC_ORDER
     580  if (bNoAdd) bSetm(p1);else
     581  #endif
    566582  _pGetOrder(p1) = _pGetOrder(p2) + _pGetOrder(p3);
    567583}
     
    595611  const unsigned long* s2;
    596612  const unsigned long* lb;
    597  
     613
    598614#ifdef WORDS_BIGENDIAN
    599615  lb = (unsigned long*) &(a->exp[0]);
     
    612628    s2 = ((unsigned long*) b) + pMonomSizeW -2;
    613629  }
    614 #else // !WORDS_BIGENDIAN 
     630#else // !WORDS_BIGENDIAN
    615631  lb = ((unsigned long*) a) + pMonomSizeW;
    616632  if (pVariables & ((SIZEOF_LONG / SIZEOF_EXPONENT) - 1))
     
    624640    s2 = (unsigned long*) &(b->exp[0]) + 1;
    625641  }
    626 #endif 
     642#endif
    627643  for (;;)
    628644  {
     
    640656    if (s1 == lb) return TRUE;
    641657    s2++;
    642 #endif   
     658#endif
    643659  }
    644660}
     
    660676    s2--;
    661677  }
    662  
     678
    663679#else // !WORDS_BIGENDIAN
    664680  const Exponent_t* s1 = &(a->exp[pVarLowIndex]);
     
    713729#endif // defined(PDEBUG) && PDEBUG == 1
    714730
    715  
     731
    716732DECLARE(BOOLEAN, _pEqual(poly p1, poly p2))
    717733{
    718 #ifndef COMP_NO_EXP_VECTOR_OPS 
     734#ifndef COMP_NO_EXP_VECTOR_OPS
    719735  const long *s1 = (long*) &(p1->exp[0]);
    720736  const long *s2 = (long*) &(p2->exp[0]);
     
    725741  const Exponent_t* const lb = s1 + pVariables;
    726742  if (_pGetComp(p1) != _pGetComp(p2)) return FALSE;
    727 #endif 
     743#endif
    728744
    729745  for(;;)
     
    787803
    788804#ifdef TEST_MAC_ORDER
    789 extern pSetmProc pSetm;
    790805DECLARE(void, pMonAddFast(poly a, poly m))
    791806{
    792807  for(int ii =pVariables; ii; ii--) (a)->exp[ii] += (m)->exp[ii];\
    793   if (bNoAdd) pSetm(a);
    794   else _pGetOrder(a) += _pGetOrder(m);
     808  if (bNoAdd) bSetm(a); else
     809  _pGetOrder(a) += _pGetOrder(m);
    795810}
    796811#else
     
    830845  int j = p->exp[from];
    831846  int i = from + 1;
    832  
     847
    833848  for(;;)
    834849  {
     
    846861    __pExpQuerSum2(p, _pExpIndex(to), _pExpIndex(1)) : \
    847862    __pExpQuerSum2(p, _pExpIndex(1), _pExpIndex(to)))
    848  
     863
    849864#define _pExpQuerSum2(p,from,to) \
    850865 (_pHasReverseExp ? \
     
    858873
    859874#endif
    860            
     875
    861876#endif // POLYS_IMPL_H
    862877
Note: See TracChangeset for help on using the changeset viewer.