Changeset b1ff71 in git


Ignore:
Timestamp:
Jul 14, 2010, 11:01:55 PM (14 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
81104ed2dadbfad0477badcdf86b06b1a0b0e59c
Parents:
29c5bddc7323e57463888d471da9ef0f6645cb2e
Message:
toward long for exponents

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

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r29c5bd rb1ff71  
    10481048      b=(poly)v->CopyD(POLY_CMD); // works also for VECTOR_CMD
    10491049      if ((a!=NULL) && (b!=NULL)
    1050       && (pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing),currRing->bitmask)))
     1050      && (pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing),(long)currRing->bitmask)))
    10511051      {
    10521052        Werror("OVERFLOW in mult(d=%ld, d=%ld, max=%ld)",
     
    10631063    b=pCopy((poly)v->Data());
    10641064    if ((a!=NULL) && (b!=NULL)
    1065     && (pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing),currRing->bitmask)))
     1065    && (pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing),(long)currRing->bitmask)))
    10661066    {
    10671067      Werror("OVERFLOW in mult(d=%ld, d=%ld, max=%ld)",
  • kernel/maps.cc

    r29c5bd rb1ff71  
    409409      for(j=N-1;j>=0;j--)
    410410      {
    411         m[j]=si_max(m[j],p_GetExp( p,j+1,preimage_r));
     411        m[j]=si_max(m[j],(int)p_GetExp( p,j+1,preimage_r));
    412412        if (m[j]>=MAX_MAP_DEG)
    413413        {
     
    443443    for(j=N-1;j>=0;j--)
    444444    {
    445       m[j]=si_max(m[j],p_GetExp(p,j+1,preimage_r));
     445      m[j]=si_max(m[j],(int)p_GetExp(p,j+1,preimage_r));
    446446      if (m[j]>=MAX_MAP_DEG)
    447447      {
  • kernel/pInline2.h

    r29c5bd rb1ff71  
    113113/// 2. number of bits to shift to the right in the upper 8 bits (which takes at most 6 bits for 64 bit)
    114114/// Thus VarOffset always has 2 zero higher bits!
    115 PINLINE2 int p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
     115PINLINE2 long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
    116116{
    117117  pAssume2((VarOffset >> (24 + 6)) == 0);
     
    119119  int pos=(VarOffset & 0xffffff);
    120120  int bitpos=(VarOffset >> 24);
    121   int exp=(p->exp[pos] >> bitmask) & iBitmask;
     121  unsigned long exp=(p->exp[pos] >> bitmask) & iBitmask;
    122122  return exp;
    123123#else
    124   return (int)
     124  return (long)
    125125         ((p->exp[(VarOffset & 0xffffff)] >> (VarOffset >> 24))
    126126          & iBitmask);
     
    132132/// @Note:
    133133/// VarOffset encodes the position in p->exp @see p_GetExp
    134 PINLINE2 int p_SetExp(poly p, const int e, const unsigned long iBitmask, const int VarOffset)
     134PINLINE2 unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
    135135{
    136136  pAssume2(e>=0);
    137   pAssume2((unsigned long) e<=iBitmask);
     137  pAssume2(e<=iBitmask);
    138138  pAssume2((VarOffset >> (24 + 6)) == 0);
    139139
    140140  // shift e to the left:
    141141  register int shift = VarOffset >> 24;
    142   unsigned long ee = ((unsigned long)e) << shift /*(VarOffset >> 24)*/;
     142  unsigned long ee = e << shift /*(VarOffset >> 24)*/;
    143143  // find the bits in the exponent vector
    144144  register int offset = (VarOffset & 0xffffff);
     
    165165
    166166/// @Note: we may add some more info (6 ) into VarOffset and thus encode
    167 PINLINE2 int p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
     167PINLINE2 long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
    168168{
    169169  int pos  =(VarOffset & 0xffffff);
    170170  int hbyte= (VarOffset >> 24); // the highest byte
    171171  int bitpos = hbyte & 0x3f; // last 6 bits
    172   int bitmask = BitMask(iBitmask, hbyte >> 6);
    173 
    174   int exp=(p->exp[pos] >> bitpos) & bitmask;
     172  long bitmask = BitMask(iBitmask, hbyte >> 6);
     173
     174  long exp=(p->exp[pos] >> bitpos) & bitmask;
    175175  return exp;
    176176
    177177}
    178178
    179 PINLINE2 int p_SetExp(poly p, const int e, const unsigned long iBitmask, const int VarOffset)
     179PINLINE2 long p_SetExp(poly p, const long e, const unsigned long iBitmask, const int VarOffset)
    180180{
    181181  pAssume2(e>=0);
    182   pAssume2((unsigned long) e <= BitMask(iBitmask, VarOffset >> 30));
     182  pAssume2(e <= BitMask(iBitmask, VarOffset >> 30));
    183183
    184184  // shift e to the left:
     
    186186  int bitmask = BitMask(iBitmask, hbyte >> 6);
    187187  register int shift = hbyte & 0x3f;
    188   unsigned long ee = ((unsigned long)e) << shift;
     188  long ee = e << shift;
    189189  // find the bits in the exponent vector
    190190  register int offset = (VarOffset & 0xffffff);
     
    199199
    200200
    201 PINLINE2 int p_GetExp(const poly p, const ring r, const int VarOffset)
     201PINLINE2 long p_GetExp(const poly p, const ring r, const int VarOffset)
    202202{
    203203  p_LmCheckPolyRing2(p, r);
     
    206206}
    207207
    208 PINLINE2 int p_SetExp(poly p, const int e, const ring r, const int VarOffset)
     208PINLINE2 long p_SetExp(poly p, const long e, const ring r, const int VarOffset)
    209209{
    210210  p_LmCheckPolyRing2(p, r);
     
    216216
    217217/// get v^th exponent for a monomial
    218 PINLINE2 int p_GetExp(const poly p, const int v, const ring r)
     218PINLINE2 long p_GetExp(const poly p, const int v, const ring r)
    219219{
    220220  p_LmCheckPolyRing2(p, r);
     
    226226
    227227/// set v^th exponent for a monomial
    228 PINLINE2 int p_SetExp(poly p, const int v, const int e, const ring r)
     228PINLINE2 long p_SetExp(poly p, const int v, const long e, const ring r)
    229229{
    230230  p_LmCheckPolyRing2(p, r);
     
    239239
    240240// the following should be implemented more efficiently
    241 PINLINE2  int p_IncrExp(poly p, int v, ring r)
     241PINLINE2  long p_IncrExp(poly p, int v, ring r)
    242242{
    243243  p_LmCheckPolyRing2(p, r);
     
    246246  return p_SetExp(p,v,e,r);
    247247}
    248 PINLINE2  int p_DecrExp(poly p, int v, ring r)
     248PINLINE2  long p_DecrExp(poly p, int v, ring r)
    249249{
    250250  p_LmCheckPolyRing2(p, r);
     
    254254  return p_SetExp(p,v,e,r);
    255255}
    256 PINLINE2  int p_AddExp(poly p, int v, int ee, ring r)
     256PINLINE2  long p_AddExp(poly p, int v, long ee, ring r)
    257257{
    258258  p_LmCheckPolyRing2(p, r);
     
    261261  return p_SetExp(p,v,e,r);
    262262}
    263 PINLINE2  int p_SubExp(poly p, int v, int ee, ring r)
    264 {
    265   p_LmCheckPolyRing2(p, r);
    266   int e = p_GetExp(p,v,r);
     263PINLINE2  long p_SubExp(poly p, int v, long ee, ring r)
     264{
     265  p_LmCheckPolyRing2(p, r);
     266  long e = p_GetExp(p,v,r);
    267267  pAssume2(e >= ee);
    268268  e -= ee;
    269269  return p_SetExp(p,v,e,r);
    270270}
    271 PINLINE2  int p_MultExp(poly p, int v, int ee, ring r)
    272 {
    273   p_LmCheckPolyRing2(p, r);
    274   int e = p_GetExp(p,v,r);
     271PINLINE2  long p_MultExp(poly p, int v, long ee, ring r)
     272{
     273  p_LmCheckPolyRing2(p, r);
     274  long e = p_GetExp(p,v,r);
    275275  e *= ee;
    276276  return p_SetExp(p,v,e,r);
    277277}
    278278
    279 PINLINE2 int p_GetExpSum(poly p1, poly p2, int i, ring r)
     279PINLINE2 long p_GetExpSum(poly p1, poly p2, int i, ring r)
    280280{
    281281  p_LmCheckPolyRing2(p1, r);
     
    283283  return p_GetExp(p1,i,r) + p_GetExp(p2,i,r);
    284284}
    285 PINLINE2 int p_GetExpDiff(poly p1, poly p2, int i, ring r)
     285PINLINE2 long p_GetExpDiff(poly p1, poly p2, int i, ring r)
    286286{
    287287  return p_GetExp(p1,i,r) - p_GetExp(p2,i,r);
  • kernel/p_polys.cc

    r29c5bd rb1ff71  
    409409{
    410410  p_LmCheckPolyRing(p, r);
    411   return (long) p_ExpVectorQuerSum(p, r);
     411  return (long)p_ExpVectorQuerSum(p, r);
    412412}
    413413
  • kernel/p_polys.h

    r29c5bd rb1ff71  
    7676
    7777// Exponent
    78 PINLINE2 int p_GetExp(poly p, int v, ring r);
    79 PINLINE2 int p_SetExp(poly p, int v, int e, ring r);
    80 PINLINE2 int p_IncrExp(poly p, int v, ring r);
    81 PINLINE2 int p_DecrExp(poly p, int v, ring r);
    82 PINLINE2 int p_AddExp(poly p, int v, int ee, ring r);
    83 PINLINE2 int p_SubExp(poly p, int v, int ee, ring r);
    84 PINLINE2 int p_MultExp(poly p, int v, int ee, ring r);
    85 PINLINE2 int p_GetExpSum(poly p1, poly p2, int i, ring r);
    86 PINLINE2 int p_GetExpDiff(poly p1, poly p2, int i, ring r);
     78PINLINE2 long p_GetExp(poly p, int v, ring r);
     79PINLINE2 long p_SetExp(poly p, int v, long e, ring r);
     80PINLINE2 long p_IncrExp(poly p, int v, ring r);
     81PINLINE2 long p_DecrExp(poly p, int v, ring r);
     82PINLINE2 long p_AddExp(poly p, int v, long ee, ring r);
     83PINLINE2 long p_SubExp(poly p, int v, long ee, ring r);
     84PINLINE2 long p_MultExp(poly p, int v, long ee, ring r);
     85PINLINE2 long p_GetExpSum(poly p1, poly p2, int i, ring r);
     86PINLINE2 long p_GetExpDiff(poly p1, poly p2, int i, ring r);
    8787
    8888/***************************************************************
  • kernel/ring.cc

    r29c5bd rb1ff71  
    41064106    PrintLn();
    41074107    Print("v0:%ld ",p_GetComp(p, r));
    4108     for(i=1;i<=r->N;i++) Print(" v%d:%d",i,p_GetExp(p,i, r));
     4108    for(i=1;i<=r->N;i++) Print(" v%d:%ld",i,p_GetExp(p,i, r));
    41094109    PrintLn();
    41104110    pIter(p);
     
    41284128  PrintLn();
    41294129  Print("v0:%9ld ", p_GetComp(p, R));
    4130   for(int i = 1; i <= R->N; i++) Print(" v%d:%5d",i, p_GetExp(p, i, R));
     4130  for(int i = 1; i <= R->N; i++) Print(" v%d:%5ld",i, p_GetExp(p, i, R));
    41314131  PrintLn();
    41324132}
  • kernel/structs.h

    r29c5bd rb1ff71  
    651651static inline int si_min(const int a, const int b)  { return (a<b) ? a : b; }
    652652static inline long si_max(const long a, const long b)  { return (a>b) ? a : b; }
     653static inline unsigned long si_max(const unsigned long a, const unsigned long b)  { return (a>b) ? a : b; }
    653654static inline long si_min(const long a, const long b)  { return (a<b) ? a : b; }
     655static inline unsigned long si_min(const unsigned long a, const unsigned long b)  { return (a<b) ? a : b; }
    654656#else
    655657#define si_max(A,B) ((A) > (B) ? (A) : (B))
Note: See TracChangeset for help on using the changeset viewer.