10#undef USE_COEF_BUCKETS
11#ifdef HAVE_COEF_BUCKETS
12#define USE_COEF_BUCKETS
15#ifdef USE_COEF_BUCKETS
16#define MULTIPLY_BUCKET(B,I) do \
17 { if (B->coef[I]!=NULL) \
19 B->buckets[I]=p_Mult_q(B->buckets[I],B->coef[I],B->bucket_ring); \
24#define MULTIPLY_BUCKET(B,I)
26#ifndef USE_COEF_BUCKETS
32 assume(bucket->buckets[0] ==
NULL && bucket->buckets_length[0] == 0);
33 DECLARE_LENGTH(
const unsigned long length = r->ExpL_Size);
34 DECLARE_ORDSGN(
const long* ordsgn = r->ordsgn);
40 for (
int i = 1;
i<=bucket->buckets_used;
i++)
42 if (bucket->buckets[
i] !=
NULL)
45 p = bucket->buckets[
j];
53 p_MemCmp__T(bucket->buckets[
i]->exp,
p->exp,
length, ordsgn,
goto Equal,
goto Greater,
goto Continue);
62 (bucket->buckets_length[
j])--;
76 n_InpAdd__T(tn,
pGetCoeff(bucket->buckets[
i]), r->cf);
79 p = bucket->buckets[
i];
83 (bucket->buckets_length[
i])--;
89 p = bucket->buckets[
j];
95 (bucket->buckets_length[
j])--;
107 lt = bucket->buckets[
j];
108 bucket->buckets[
j] =
pNext(lt);
109 bucket->buckets_length[
j]--;
111 bucket->buckets[0] = lt;
112 bucket->buckets_length[0] = 1;
114 kBucketAdjustBucketsUsed(bucket);
122 assume((bucket->buckets[0] ==
NULL) && (bucket->buckets_length[0] == 0) && (bucket->coef[0]==0));
123 DECLARE_LENGTH(
const unsigned long length = r->ExpL_Size);
124 DECLARE_ORDSGN(
const long* ordsgn = r->ordsgn);
129 for (
int i = 1;
i<=bucket->buckets_used;
i++)
131 if (bucket->buckets[
i] !=
NULL)
135 p=bucket->buckets[
i];
140 p_MemCmp__T(bucket->buckets[
i]->exp,
p->exp,
length, ordsgn,
goto Continue,
goto Greater,
goto Continue);
145 p=bucket->buckets[
i];
158 for (
int i =
found+1;
i<=bucket->buckets_used;
i++)
160 if (bucket->buckets[
i] !=
NULL)
177 bucket->buckets[0] = lt;
178 bucket->buckets_length[0] = 1;
180 kBucketAdjustBucketsUsed(bucket);
CFArray copy(const CFList &list)
write elements of list into an array
static BOOLEAN Equal(number a, number b, const coeffs)
static bool Greater(mono_type m1, mono_type m2)
static BOOLEAN length(leftv result, leftv arg)
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
poly kBucketExtractLmOfBucket(kBucket_pt bucket, int i)
#define p_FreeBinAddr(p, r)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
LINKAGE void p_kBucketSetLm__T(kBucket_pt bucket)
#define MULTIPLY_BUCKET(B, I)
#define n_Delete__T(n, r)
static int pLength(poly a)
static poly p_Add_q(poly p, poly q, const ring r)
static poly p_LmInit(poly p, const ring r)
#define p_LmEqual(p1, p2, r)
static void p_Delete(poly *p, const ring r)