Changeset f3094a in git for libpolys/polys/monomials/monomials.cc
- Timestamp:
- Jul 23, 2012, 5:29:18 PM (11 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '2234726c50d679d6664181a5c72f75a6fd64a787')
- Children:
- 6779bb431ba1eced98b7cb0e1fed5fbfef1f0244
- Parents:
- 98223c2d11013c57837511c1adb1ef9a16193b3d
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-07-23 17:29:18+02:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-07-25 15:25:07+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/monomials/monomials.cc
r98223c rf3094a 30 30 #endif 31 31 32 #include <polys/monomials/ring.h>33 #include <reporter/reporter.h>34 #include <coeffs/numbers.h>35 #include <polys/monomials/ring.h>36 #include <polys/monomials/p_polys.h>37 #include <reporter/reporter.h>38 39 #ifdef PDEBUG40 int pDBsyzComp=0;41 #endif42 43 /***************************************************************44 *45 * Storage Managament Routines46 *47 ***************************************************************/48 49 50 static inline unsigned long GetBitFields(long e,51 unsigned int s, unsigned int n)52 {53 #define Sy_bit_L(x) (((unsigned long)1L)<<(x))54 unsigned int i = 0;55 unsigned long ev = 0L;56 assume(n > 0 && s < BIT_SIZEOF_LONG);57 do58 {59 assume(s+i < BIT_SIZEOF_LONG);60 if (e > (long) i) ev |= Sy_bit_L(s+i);61 else break;62 i++;63 }64 while (i < n);65 return ev;66 }67 68 // Short Exponent Vectors are used for fast divisibility tests69 // ShortExpVectors "squeeze" an exponent vector into one word as follows:70 // Let n = BIT_SIZEOF_LONG / pVariables.71 // If n == 0 (i.e. pVariables > BIT_SIZE_OF_LONG), let m == the number72 // of non-zero exponents. If (m>BIT_SIZEOF_LONG), then sev = ~0, else73 // first m bits of sev are set to 1.74 // Otherwise (i.e. pVariables <= BIT_SIZE_OF_LONG)75 // represented by a bit-field of length n (resp. n+1 for some76 // exponents). If the value of an exponent is greater or equal to n, then77 // all of its respective n bits are set to 1. If the value of an exponent78 // is smaller than n, say m, then only the first m bits of the respective79 // n bits are set to 1, the others are set to 0.80 // This way, we have:81 // exp1 / exp2 ==> (ev1 & ~ev2) == 0, i.e.,82 // if (ev1 & ~ev2) then exp1 does not divide exp283 unsigned long p_GetShortExpVector(poly p, const ring r)84 {85 assume(p != NULL);86 if (p == NULL) return 0;87 unsigned long ev = 0; // short exponent vector88 unsigned int n = BIT_SIZEOF_LONG / r->N; // number of bits per exp89 unsigned int m1; // highest bit which is filled with (n+1)90 unsigned int i = 0, j=1;91 92 if (n == 0)93 {94 if (r->N <2*BIT_SIZEOF_LONG)95 {96 n=1;97 m1=0;98 }99 else100 {101 for (; j<=(unsigned long) r->N; j++)102 {103 if (p_GetExp(p,j,r) > 0) i++;104 if (i == BIT_SIZEOF_LONG) break;105 }106 if (i>0)107 ev = ~((unsigned long)0) >> ((unsigned long) (BIT_SIZEOF_LONG - i));108 return ev;109 }110 }111 else112 {113 m1 = (n+1)*(BIT_SIZEOF_LONG - n*r->N);114 }115 116 n++;117 while (i<m1)118 {119 ev |= GetBitFields(p_GetExp(p, j,r), i, n);120 i += n;121 j++;122 }123 124 n--;125 while (i<BIT_SIZEOF_LONG)126 {127 ev |= GetBitFields(p_GetExp(p, j,r), i, n);128 i += n;129 j++;130 }131 return ev;132 }133 32 134 33 #endif // POLYS_IMPL_CC
Note: See TracChangeset
for help on using the changeset viewer.