18 #ifdef HAVE_COEF_BUCKETS 19 #define USE_COEF_BUCKETS 22 #ifdef USE_COEF_BUCKETS 24 #define MULTIPLY_BUCKET(B,I) do \ 25 { if (B->coef[I]!=NULL) \ 27 assume(p_IsConstant(B->Coef[i],B->bucket->ring)); \ 28 B->buckets[I]=p_Mult_q(B->buckets[I],B->coef[I],B->bucket_ring); \ 32 if (rField_is_Ring(B->bucket_ring)) B->buckets_length[i] = pLength(B->buckets[i]); 34 #define MULTIPLY_BUCKET(B,I) do \ 35 { if (B->coef[I]!=NULL) \ 37 B->buckets[I]=p_Mult_q(B->buckets[I],B->coef[I],B->bucket_ring); \ 43 #define MULTIPLY_BUCKET(B,I) 46 #ifdef USE_COEF_BUCKETS 47 static int coef_start=1;
61 #ifdef BUCKET_TWO_BASE 62 while ((
l = (
l >> 1)))
i++;
64 while ((
l = (
l >> 2)))
i++;
77 #ifndef HAVE_PSEUDO_BUCKETS 80 #ifdef USE_COEF_BUCKETS 95 dReportError(
"Bucket %d lengths difference should:%d has:%d",
103 if (
i==0 &&
bucket->buckets_length[0] > 1)
113 #ifdef HAVE_COEF_BUCKETS 122 for (
i=1;
i<= (int)
bucket->buckets_used;
i++)
162 #ifdef HAVE_COEF_BUCKETS 180 #else // HAVE_PSEUDO_BUCKETS 185 #endif // ! HAVE_PSEUDO_BUCKETS 197 bucket->bucket_ring = bucket_ring;
218 #ifdef USE_COEF_BUCKETS 231 #ifndef HAVE_PSEUDO_BUCKETS 240 #ifdef BUCKET_TWO_BASE 242 while (
bucket->buckets_length[
i] >=
l)
249 while (
bucket->buckets_length[
i] >=
l)
255 #ifndef USE_COEF_BUCKETS 260 assume(i <= bucket->buckets_used+1);
263 bucket->buckets_length[0] = 0;
274 assume(i <= bucket->buckets_used+1);
297 assume(i <= bucket->buckets_used+1);
301 bucket->buckets_length[0] = 0;
316 #ifdef HAVE_COEF_BUCKETS 331 if (lm ==
NULL)
return;
337 #ifdef HAVE_COEF_BUCKETS 340 #ifdef USE_COEF_BUCKETS 344 bucket->buckets_length[0] = 1;
346 bucket->buckets_length[0]= 0;
352 bucket->buckets_length[
i] = length-1;
368 int pl =
bucket->buckets_length[1];
371 bucket->buckets_length[1] = 0;
372 #ifdef USE_COEF_BUCKETS 380 #ifdef USE_COEF_BUCKETS 400 #ifdef HAVE_COEF_BUCKETS 410 bucket->buckets_length[0] = 0;
416 bucket->buckets_length[
i] = pl;
424 #ifdef USE_COEF_BUCKETS 439 #ifdef USE_COEF_BUCKETS 444 *length =
bucket->buckets_length[
i];
462 bucket->buckets_length[0] = 1;
465 #else // HAVE_PSEUDO_BUCKETS 504 #endif // ! HAVE_PSEUDO_BUCKETS 510 ring new_tailRing,
omBin new_tailBin,
513 #ifndef HAVE_PSEUDO_BUCKETS 527 bucket->p = p_shallow_copy_delete(
p,
532 bucket->bucket_ring = new_tailRing;
543 int l1 =
bucket->buckets_length[
i];
565 kBucketAdjustBucketsUsed(
bucket);
574 #ifndef HAVE_PSEUDO_BUCKETS 583 #ifdef USE_COEF_BUCKETS 630 if (q ==
NULL)
return;
651 #ifdef USE_COEF_BUCKETS 679 kBucketAdjustBucketsUsed(
bucket);
708 #ifndef HAVE_PSEUDO_BUCKETS 713 #if defined(HAVE_PLURAL) 726 if ((i <= bucket->buckets_used) && (
bucket->buckets[
i] !=
NULL))
744 l1 =
bucket->buckets_length[
i];
752 if (spNoether !=
NULL)
755 p1 =
r->p_Procs->pp_Mult_mm_Noether(p1,
m, spNoether, l1,
r);
760 p1 =
r->p_Procs->pp_Mult_mm(p1,
m,
r);
782 kBucketAdjustBucketsUsed(
bucket);
783 #else // HAVE_PSEUDO_BUCKETS 816 #ifdef USE_COEF_BUCKETS 819 if (i <= bucket->buckets_used &&
bucket->buckets[
i] !=
NULL)
822 #ifdef USE_COEF_BUCKETS 837 orig_coef=orig_coef2;
870 l1 =
bucket->buckets_length[
i];
878 #ifdef USE_COEF_BUCKETS 887 p1 =
r->p_Procs->pp_Mult_mm(p1,
m,
r);
888 #ifdef USE_COEF_BUCKETS 897 #ifdef USE_COEF_BUCKETS 913 orig_coef=orig_coef2;
935 #ifdef USE_COEF_BUCKETS 953 #ifdef USE_COEF_BUCKETS 973 kBucketAdjustBucketsUsed(
bucket);
1019 #ifndef HAVE_PSEUDO_BUCKETS 1030 bucket->buckets_length[
i] -= lq;
1036 kBucketAdjustBucketsUsed(
bucket);
1088 if ((ct == 0) || (ct == 2))
1153 #ifndef USE_COEF_BUCKETS 1156 static BOOLEAN nIsPseudoUnit(number n, ring
r)
1218 if (nIsPseudoUnit(coef,
r))
1255 #ifdef USE_COEF_BUCKETS 1301 number an = *
a, bn = *
b;
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
CFFList append(const CFFList &Inputlist, const CFFactor &TheFactor)
BOOLEAN kbTest(kBucket_pt bucket)
Tests
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
poly kBucketExtractLmOfBucket(kBucket_pt bucket, int i)
#define MULTIPLY_BUCKET(B, I)
void kBucketShallowCopyDelete(kBucket_pt bucket, ring new_tailRing, omBin new_tailBin, pShallowCopyDeleteProc p_shallow_copy_delete)
For changing the ring of the Bpoly to new_tailBin
void kBucketInit(kBucket_pt bucket, poly lm, int length)
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
const poly kBucketGetLm(kBucket_pt bucket)
int ksCheckCoeff(number *a, number *b)
#define MAX_BUCKET
Bucket definition (should be no one elses business, though)
static poly pp_Mult_mm(poly p, poly m, const ring r)
static BOOLEAN rField_is_Domain(const ring r)
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
static char const ** rParameter(const ring r)
(r->cf->parameter)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
void kBucket_Mult_n(kBucket_pt bucket, number n)
Multiply Bucket by number ,i.e. Bpoly == n*Bpoly
static number p_SetCoeff(poly p, number n, ring r)
poly kBucketExtractLm(kBucket_pt bucket)
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
#define pFalseReturn(cond)
poly kBucket_ExtractLarger(kBucket_pt bucket, poly q, poly append)
Extract all monomials of bucket which are larger than q Append those to append, and return last mono...
Coefficient rings, fields and other domains suitable for Singular polynomials.
void kBucketDestroy(kBucket_pt *bucket_pt)
static void p_SetCompP(poly p, int i, ring r)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static BOOLEAN p_IsConstant(const poly p, const ring r)
The main handler for Singular numbers which are suitable for Singular polynomials.
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
void kBucketSetLm(kBucket_pt bucket, poly lm)
static int p_LmCmp(poly p, poly q, const ring r)
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
void kBucketSimpleContent(kBucket_pt)
#define omCheckAddrBin(addr, bin)
void PrintS(const char *s)
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
static poly p_Mult_nn(poly p, number n, const ring r)
static unsigned pLength(poly a)
void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l, poly spNoether)
Bpoly == Bpoly - m*p; where m is a monom Does not destroy p and m assume (*l <= 0 || pLength(p) == *...
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
void kBucketAdjust(kBucket_pt bucket, int i)
Bucket number i from bucket is out of length sync, resync
static BOOLEAN rField_is_Zp(const ring r)
static void p_Delete(poly *p, const ring r)
#define omGetSpecBin(size)
#define p_LmEqual(p1, p2, r)
unsigned int pLogLength(unsigned int l)
Some internal stuff
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
static BOOLEAN rField_is_Ring(const ring r)
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
void kBucket_Plus_mm_Mult_pp(kBucket_pt bucket, poly m, poly p, int l)
Bpoly == Bpoly + m*p; where m is a monom Does not destroy p and m assume (l <= 0 || pLength(p) == l)...
static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
assume that there is a canonical subring in cf and we know that division is possible for these a and ...
static void p_Setm(poly p, const ring r)
static poly p_Minus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp, int lq, const poly spNoether, const ring r)
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
int dReportError(const char *fmt,...)
static void p_LmDelete(poly p, const ring r)
#define p_SetCoeff0(p, n, r)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
static poly p_Add_q(poly p, poly q, const ring r)
BOOLEAN kBucketIsCleared(kBucket_pt bucket)
#define omFreeBin(addr, bin)
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets
int kBucketCanonicalize(kBucket_pt bucket)
static FORCE_INLINE int n_Size(number n, const coeffs r)
return a non-negative measure for the complexity of n; return 0 only when n represents zero; (used fo...
void kBucketDeleteAndDestroy(kBucket_pt *bucket_pt)
void kBucketTakeOutComp(kBucket_pt bucket, long comp, poly *r_p, int *l)
static poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, const ring r)
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly