Changeset ec96d7 in git


Ignore:
Timestamp:
Jul 7, 2010, 5:51:59 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
Children:
e471bdd43569e854291611e8809c823f09178a34
Parents:
a23b2107d8a272d2243292dc7d9703920aa2bd55
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2010-07-07 17:51:59+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:55:23+01:00
Message:
monomials.h defines poly
Location:
polys
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • polys/Makefile.in

    ra23b21 rec96d7  
    3434CXXFLAGS        = -O3 -w -fomit-frame-pointer --no-rtti ${PIPE}
    3535CXXTEMPLFLAGS   = -fno-implicit-templates --no-exceptions
    36 CPPFLAGS        = -I${srcdir} -I${includedir} -I${srcdir}../misc/
     36CPPFLAGS        = -I${srcdir} -I${includedir}
    3737DEFS            = -DNDEBUG -DOM_NDEBUG -Dix86_Linux -DHAVE_CONFIG_H
    3838
  • polys/monomials/polys-impl.h

    ra23b21 rec96d7  
    1919#include <coeffs.h>
    2020
    21 /***************************************************************
    22  *
    23  * definition of the poly structure and its fields
    24  *
    25  ***************************************************************/
    26 
    27 struct  spolyrec
    28 {
    29   poly      next;           // next needs to be the first field
    30   number    coef;           // and coef the second --- do not change this !!!
    31   unsigned long exp[1];     // make sure that exp is aligned
    32 };
    33 typedef struct spolyrec *          poly;
    34 
    3521#define POLYSIZE (sizeof(poly) + sizeof(number))
    3622#define POLYSIZEW (POLYSIZE / sizeof(long))
     
    4127#endif
    4228
    43 
    44 /***************************************************************
    45  *
    46  * What should be inlined and debugged?
    47  *
    48  ***************************************************************/
    49 // determines inlining of poly procs which iter through polys
    50 #if defined(DO_PINLINE0) && !defined(PDEBUG)
    51 #define PINLINE0 static inline
    52 #else
    53 #define PINLINE0
    54 #endif
    55 
    56 // determines inlining of poly procs which iter over ExpVector
    57 #undef NO_PINLINE1
    58 #if PDEBUG <= 0 && !defined(NO_INLINE1)
    59 #define PINLINE1 static inline
    60 #else
    61 #define PINLINE1
    62 #define NO_PINLINE1 1
    63 #endif
    64 
    65 // determines inlining of constant time poly procs
    66 #undef NO_PINLINE2
    67 #if PDEBUG <= 1 && !defined(NO_INLINE2)
    68 #define PINLINE2 static inline
    69 #else
    70 #define PINLINE2
    71 #define NO_PINLINE2 1
    72 #endif
    73 
    74 // determines inlining of stuff from polys-impl.h
    75 #undef NO_PINLINE3
    76 #if PDEBUG <= 2 && !defined(NO_INLINE3)
    77 #define PINLINE3 static inline
    78 #else
    79 #define PINLINE3
    80 #define NO_PINLINE3 1
    81 #endif
    82 
    83 /***************************************************************
    84  *
    85  * prepare debugging
    86  *
    87  ***************************************************************/
    88 
    89 #if defined(PDEBUG)
    90 
    91 extern BOOLEAN dPolyReportError(poly p, ring r, const char* fmt, ...);
    92 
    93 // macros for checking of polys
    94 #define pAssumeReturn(cond)                                  \
    95 do                                                          \
    96 {                                                           \
    97   if (! (cond))                                             \
    98   {                                                         \
    99     dPolyReportError(NULL, NULL, "pAssume violation of: %s", \
    100                  #cond);                                    \
    101     return FALSE;                                           \
    102   }                                                         \
    103 }                                                           \
    104 while (0)
    105 
    106 #define pAssume(cond)                                        \
    107 do                                                          \
    108 {                                                           \
    109   if (! (cond))                                             \
    110   {                                                         \
    111     dPolyReportError(NULL, NULL, "pAssume violation of: %s", \
    112                  #cond);                                    \
    113   }                                                         \
    114 }                                                           \
    115 while (0)
    116 
    117 #define pPolyAssumeReturn(cond, p, r)                       \
    118 do                                                          \
    119 {                                                           \
    120   if (! (cond))                                             \
    121   {                                                         \
    122     dPolyReportError(p, r, "pPolyAssume violation of: %s",   \
    123                  #cond);                                    \
    124     return FALSE;                                           \
    125   }                                                         \
    126 }                                                           \
    127 while (0)
    128 
    129 #define pPolyAssume(cond,p,r)                                   \
    130 do                                                              \
    131 {                                                               \
    132   if (! (cond))                                                 \
    133   {                                                             \
    134     dPolyReportError(p, r, "pPolyAssume violation of: %s",    \
    135                  #cond);                                        \
    136   }                                                             \
    137 }                                                               \
    138 while (0)
    139 
    140 #define pPolyAssumeReturnMsg(cond, msg, p, r)   \
    141 do                                              \
    142 {                                               \
    143   if (! (cond))                                 \
    144   {                                             \
    145     dPolyReportError(p, r, "%s ",  msg);        \
    146     return FALSE;                               \
    147   }                                             \
    148 }                                               \
    149 while (0)
    150 
    151 #define pFalseReturn(cond)  do {if (! (cond)) return FALSE;} while (0)
    152 #if (OM_TRACK > 2) && defined(OM_TRACK_CUSTOM)
    153 #define p_SetRingOfLm(p, r) omSetCustomOfAddr(p, r)
    154 void p_SetRingOfLeftv(leftv l, ring r);
    155 #else
    156 #define p_SetRingOfLm(p, r) ((void)0)
    157 #define p_SetRingOfLeftv(l, r) ((void)0)
    158 #endif
    159 
    160 #else // ! defined(PDEBUG)
    161 #define pFalseReturn(cond)           ((void)0)
    162 #define pAssume(cond)                ((void)0)
    163 #define pPolyAssume(cond, p,r)      ((void)0)
    164 #define pPolyAssumeReturn(cond,p,r) ((void)0)
    165 #define p_SetRingOfLm(p, r)          ((void)0)
    166 #define p_SetRingOfLeftv(l, r)       ((void)0)
    167 #endif // defined(PDEBUG)
    168 
    169 #if PDEBUG >= 1
    170 #define pAssume1             pAssume
    171 #define pPolyAssume1         pPolyAssume
    172 #define pAssumeReturn1       pAssumeReturn
    173 #define pPolyAssumeReturn1   pPolyAssumeReturn
    174 #define _pPolyAssumeReturn1  _pPolyAssumeReturn
    175 #define p_LmCheckPolyRing1    p_LmCheckPolyRing
    176 #define p_CheckRing1        p_CheckRing
    177 #define pIfThen1          pIfThen
    178 #else
    179 #define pAssume1(cond)               ((void)0)
    180 #define pPolyAssume1(cond)           ((void)0)
    181 #define pAssumeReturn1(cond)         ((void)0)
    182 #define pPolyAssumeReturn1(cond)     ((void)0)
    183 #define p_LmCheckPolyRing1(p,r)       ((void)0)
    184 #define p_CheckRing1(r)             ((void)0)
    185 #define pIfThen1(cond, check)     ((void)0)
    186 #endif // PDEBUG >= 1
    187 
    188 #if PDEBUG >= 2
    189 #define pAssume2             pAssume
    190 #define pPolyAssume2         pPolyAssume
    191 #define pAssumeReturn2       pAssumeReturn
    192 #define pPolyAssumeReturn2   pPolyAssumeReturn
    193 #define p_LmCheckPolyRing2    p_LmCheckPolyRing
    194 #define p_CheckRing2        p_CheckRing
    195 #define pIfThen2          pIfThen
    196 #else
    197 #define pAssume2(cond)                   ((void)0)
    198 #define pPolyAssume2(cond,p,r)           ((void)0)
    199 #define pAssumeReturn2(cond,p,r)         ((void)0)
    200 #define pPolyAssumeReturn2(cond,p,r)     ((void)0)
    201 #define p_LmCheckPolyRing2(p,r)          ((void)0)
    202 #define p_CheckRing2(r)                  ((void)0)
    203 #define pIfThen2(cond, check)            ((void)0)
    204 #endif // PDEBUG >= 2
    205 
    206 /***************************************************************
    207  *
    208  * Macros for access/iteration
    209  *
    210  ***************************************************************/
    211 
    212 #define __p_GetComp(p, r)   (p)->exp[r->pCompIndex]
    213 #define p_GetComp(p, r)    ((long) (r->pCompIndex >= 0 ? __p_GetComp(p, r) : 0))
    21429
    21530/***************************************************************
  • polys/monomials/ring.h

    ra23b21 rec96d7  
    1111/* includes */
    1212#include <coeffs.h>
    13 #include "polys-impl.h"
    14 
    15 #define SHORT_REAL_LENGTH 6 // use short reals for real <= 6 digits
    16 
    17 // #ifdef HAVE_PLURAL
    18 #if 0
    19 enum nc_type
    20 {
    21   nc_error = -1, // Something's gone wrong!
    22   nc_general = 0, /* yx=q xy+... */
    23   nc_skew, /*1*/ /* yx=q xy */
    24   nc_comm, /*2*/ /* yx= xy */
    25   nc_lie,  /*3*/ /* yx=xy+... */
    26   nc_undef, /*4*/  /* for internal reasons */
    27 
    28   nc_exterior /*5*/ // Exterior Algebra(SCA): yx= -xy & (!:) x^2 = 0
    29 };
    30 #endif
    31 // #endif
     13//#include "polys-impl.h"
    3214
    3315enum tHomog
     
    3820};
    3921
    40 //extern ring      currRing;
    41 //extern ideal     currQuotient;
    42 //extern idhdl      currRingHdl;
    43 
    44 
    4522void   rChangeCurrRing(ring r);
    46 void   rSetHdl(idhdl h);
    47 ring   rInit(sleftv* pn, sleftv* rv, sleftv* ord);
     23//void   rSetHdl(idhdl h);
     24//ring   rInit(sleftv* pn, sleftv* rv, sleftv* ord);
    4825idhdl  rDefault(const char *s);
    4926ring   rDefault(int ch, int N, char **n);
     
    5330int    r_IsRingVar(const char *n, ring r);
    5431void   rWrite(ring r);
    55 void   rKill(idhdl h);
     32//void   rKill(idhdl h);
    5633void   rKill(ring r);
    5734ring   rCopy(ring r);
     
    10582void rNGetSComps(int** currComponents, long** currShiftedComponents, ring r = currRing);
    10683
    107 idhdl  rFindHdl(ring r, idhdl n, idhdl w);
    108 idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n);
     84//idhdl  rFindHdl(ring r, idhdl n, idhdl w);
     85//idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n);
    10986const char * rSimpleOrdStr(int ord);
    11087int rOrderName(char * ordername);
     
    11390char * rCharStr(ring r);
    11491char * rString(ring r);
    115 int    rChar(ring r=currRing);
     92int    rChar(ring r);
    11693#define rPar(r) (r->P)
    11794#define rVar(r) (r->N)
     
    125102void   rUnComplete(ring r);
    126103
    127 #define  rInternalChar(r) ((r)->ch)
    128 
    129 BOOLEAN rRing_is_Homog(ring r=currRing);
    130 BOOLEAN rRing_has_CompLastBlock(ring r=currRing);
     104BOOLEAN rRing_is_Homog(ring r);
     105BOOLEAN rRing_has_CompLastBlock(ring r);
    131106
    132107#ifdef HAVE_RINGS
    133 static inline BOOLEAN rField_is_Ring_2toM(ring r=currRing)
     108static inline BOOLEAN rField_is_Ring_2toM(ring r)
    134109{ return (r->ringtype == 1); }
    135110
    136 static inline BOOLEAN rField_is_Ring_ModN(ring r=currRing)
     111static inline BOOLEAN rField_is_Ring_ModN(ring r)
    137112{ return (r->ringtype == 2); }
    138113
    139 static inline BOOLEAN rField_is_Ring_PtoM(ring r=currRing)
     114static inline BOOLEAN rField_is_Ring_PtoM(ring r)
    140115{ return (r->ringtype == 3); }
    141116
    142 static inline BOOLEAN rField_is_Ring_Z(ring r=currRing)
     117static inline BOOLEAN rField_is_Ring_Z(ring r)
    143118{ return (r->ringtype == 4); }
    144119
    145 static inline BOOLEAN rField_is_Ring(ring r=currRing)
     120static inline BOOLEAN rField_is_Ring(ring r)
    146121{ return (r->ringtype != 0); }
    147122
    148 static inline BOOLEAN rField_is_Domain(ring r=currRing)
     123static inline BOOLEAN rField_is_Domain(ring r)
    149124{ return (r->ringtype == 4 || r->ringtype == 0); }
    150125
    151 static inline BOOLEAN rField_has_Units(ring r=currRing)
     126static inline BOOLEAN rField_has_Units(ring r)
    152127{ return ((r->ringtype == 1) || (r->ringtype == 2) || (r->ringtype == 3)); }
    153128#else
     
    162137
    163138#ifdef HAVE_RINGS
    164 static inline BOOLEAN rField_is_Zp(ring r=currRing)
     139static inline BOOLEAN rField_is_Zp(ring r)
    165140{ return (r->ringtype == 0) && (r->ch > 1) && (r->parameter==NULL); }
    166141
     
    168143{ return (r->ringtype == 0) && (r->ch > 1 && r->ch == ABS(p) && r->parameter==NULL); }
    169144
    170 static inline BOOLEAN rField_is_Q(ring r=currRing)
     145static inline BOOLEAN rField_is_Q(ring r)
    171146{ return (r->ringtype == 0) && (r->ch == 0) && (r->parameter==NULL); }
    172147
    173 static inline BOOLEAN rField_is_numeric(ring r=currRing) /* R, long R, long C */
     148static inline BOOLEAN rField_is_numeric(ring r) /* R, long R, long C */
    174149{ return (r->ringtype == 0) && (r->ch ==  -1); }
    175150
    176 static inline BOOLEAN rField_is_R(ring r=currRing)
     151static inline BOOLEAN rField_is_R(ring r)
    177152{
    178153  if (rField_is_numeric(r) && (r->float_len <= (short)SHORT_REAL_LENGTH))
     
    181156}
    182157
    183 static inline BOOLEAN rField_is_GF(ring r=currRing)
     158static inline BOOLEAN rField_is_GF(ring r)
    184159{ return (r->ringtype == 0) && (r->ch > 1) && (r->parameter!=NULL); }
    185160
     
    187162{ return (r->ringtype == 0) && (r->ch == q); }
    188163
    189 static inline BOOLEAN rField_is_Zp_a(ring r=currRing)
     164static inline BOOLEAN rField_is_Zp_a(ring r)
    190165{ return (r->ringtype == 0) && (r->ch < -1); }
    191166
     
    193168{ return (r->ringtype == 0) && (r->ch < -1 ) && (-(r->ch) == ABS(p)); }
    194169
    195 static inline BOOLEAN rField_is_Q_a(ring r=currRing)
     170static inline BOOLEAN rField_is_Q_a(ring r)
    196171{ return (r->ringtype == 0) && (r->ch == 1); }
    197172
    198 static inline BOOLEAN rField_is_long_R(ring r=currRing)
     173static inline BOOLEAN rField_is_long_R(ring r)
    199174{
    200175  if (rField_is_numeric(r) && (r->float_len >(short)SHORT_REAL_LENGTH))
     
    203178}
    204179
    205 static inline BOOLEAN rField_is_long_C(ring r=currRing)
     180static inline BOOLEAN rField_is_long_C(ring r)
    206181{
    207182  if (rField_is_numeric(r))
     
    210185}
    211186#else
    212 static inline BOOLEAN rField_is_Zp(ring r=currRing)
     187static inline BOOLEAN rField_is_Zp(ring r)
    213188{ return (r->ch > 1) && (r->parameter==NULL); }
    214189
     
    216191{ return (r->ch > 1 && r->ch == ABS(p) && r->parameter==NULL); }
    217192
    218 static inline BOOLEAN rField_is_Q(ring r=currRing)
     193static inline BOOLEAN rField_is_Q(ring r)
    219194{ return (r->ch == 0) && (r->parameter==NULL); }
    220195
    221 static inline BOOLEAN rField_is_numeric(ring r=currRing) /* R, long R, long C */
     196static inline BOOLEAN rField_is_numeric(ring r) /* R, long R, long C */
    222197{ return (r->ch ==  -1); }
    223198
    224 static inline BOOLEAN rField_is_R(ring r=currRing)
     199static inline BOOLEAN rField_is_R(ring r)
    225200{
    226201  if (rField_is_numeric(r) && (r->float_len <= (short)SHORT_REAL_LENGTH))
     
    229204}
    230205
    231 static inline BOOLEAN rField_is_GF(ring r=currRing)
     206static inline BOOLEAN rField_is_GF(ring r)
    232207{ return (r->ch > 1) && (r->parameter!=NULL); }
    233208
     
    235210{ return (r->ch == q); }
    236211
    237 static inline BOOLEAN rField_is_Zp_a(ring r=currRing)
     212static inline BOOLEAN rField_is_Zp_a(ring r)
    238213{ return (r->ch < -1); }
    239214
     
    241216{ return (r->ch < -1 ) && (-(r->ch) == ABS(p)); }
    242217
    243 static inline BOOLEAN rField_is_Q_a(ring r=currRing)
     218static inline BOOLEAN rField_is_Q_a(ring r)
    244219{ return (r->ch == 1); }
    245220
    246 static inline BOOLEAN rField_is_long_R(ring r=currRing)
     221static inline BOOLEAN rField_is_long_R(ring r)
    247222{
    248223  if (rField_is_numeric(r) && (r->float_len >(short)SHORT_REAL_LENGTH))
     
    251226}
    252227
    253 static inline BOOLEAN rField_is_long_C(ring r=currRing)
     228static inline BOOLEAN rField_is_long_C(ring r)
    254229{
    255230  if (rField_is_numeric(r))
     
    259234#endif
    260235
    261 static inline BOOLEAN rField_has_simple_inverse(ring r=currRing)
     236static inline BOOLEAN rField_has_simple_inverse(ring r)
    262237/* { return (r->ch>1) || (r->ch== -1); } *//* Z/p, GF(p,n), R, long_R, long_C*/
    263238#ifdef HAVE_RINGS
     
    267242#endif
    268243
    269 static inline BOOLEAN rField_has_simple_Alloc(ring r=currRing)
     244static inline BOOLEAN rField_has_simple_Alloc(ring r)
    270245{ return (rField_is_Zp(r)
    271246       || rField_is_GF(r)
     
    276251
    277252/* Z/p, GF(p,n), R: nCopy, nNew, nDelete are dummies*/
    278 static inline BOOLEAN rField_is_Extension(ring r=currRing)
     253static inline BOOLEAN rField_is_Extension(ring r)
    279254{ return (rField_is_Q_a(r)) || (rField_is_Zp_a(r)); } /* Z/p(a) and Q(a)*/
    280255
     
    385360
    386361// return TRUE if p->exp[r->pOrdIndex] holds total degree of p */
    387 //inline BOOLEAN rHasGlobalOrdering(const ring r=currRing)
     362//inline BOOLEAN rHasGlobalOrdering(const ring r)
    388363//{ return (r->OrdSgn==1); }
    389364#define rHasGlobalOrdering(R) ((R)->OrdSgn==1)
    390365#define rHasGlobalOrdering_currRing() (pOrdSgn==1)
    391 //inline BOOLEAN rHasLocalOrMixedOrdering(const ring r=currRing)
     366//inline BOOLEAN rHasLocalOrMixedOrdering(const ring r)
    392367//{ return (r->OrdSgn==-1); }
    393368#define rHasLocalOrMixedOrdering(R) ((R)->OrdSgn==-1)
    394369#define rHasLocalOrMixedOrdering_currRing() (pOrdSgn==-1)
    395 BOOLEAN rOrd_is_Totaldegree_Ordering(ring r =currRing);
     370BOOLEAN rOrd_is_Totaldegree_Ordering(ring r );
    396371
    397372/// return TRUE if p_SetComp requires p_Setm
  • polys/pDebug.cc

    ra23b21 rec96d7  
    2323// #define PDEBUG 2
    2424
    25 #include "p_polys.h"
     25//#include "p_polys.h"
    2626#include <output.h>
    2727#include <omalloc.h>
    28 #include "ring.h"
     28#include "monomials/ring.h"
    2929#include <coeffs.h>
    3030
     
    346346#endif // PDEBUG
    347347
    348 #include <kernel/pInline1.h>
    349 
    350348#if defined(PDEBUG) || defined(PDIV_DEBUG)
    351349static unsigned long pDivisibleBy_number = 1;
  • polys/pInline0.cc

    ra23b21 rec96d7  
    1111#ifndef PINLINE0_CC
    1212
    13 #include <kernel/mod2.h>
     13#include "config.h"
    1414
    1515#define PINLINE0_CC
Note: See TracChangeset for help on using the changeset viewer.