My Project  UNKNOWN_GIT_VERSION
Macros | Functions
p_kBucketSetLm__T.cc File Reference

Go to the source code of this file.

Macros

#define MULTIPLY_BUCKET(B, I)
 

Functions

LINKAGE void p_kBucketSetLm__T (kBucket_pt bucket)
 

Macro Definition Documentation

◆ MULTIPLY_BUCKET

#define MULTIPLY_BUCKET (   B,
 
)

Definition at line 24 of file p_kBucketSetLm__T.cc.

Function Documentation

◆ p_kBucketSetLm__T()

LINKAGE void p_kBucketSetLm__T ( kBucket_pt  bucket)

Definition at line 27 of file p_kBucketSetLm__T.cc.

28 {
29  int j = 0;
30  poly lt;
31  ring r = bucket->bucket_ring;
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);
35  poly p;
36 
37  do
38  {
39  j = 0;
40  for (int i = 1; i<=bucket->buckets_used; i++)
41  {
42  if (bucket->buckets[i] != NULL)
43  {
44  MULTIPLY_BUCKET(bucket,i);
45  p = bucket->buckets[j];
46  if (j == 0)
47  {
48  if (p != NULL) goto Greater;
49  j = i;
50  goto Continue;
51  }
52  assume(p != NULL);
53  p_MemCmp__T(bucket->buckets[i]->exp, p->exp, length, ordsgn, goto Equal, goto Greater, goto Continue);
54 
55  Greater:
56  {
57  if (n_IsZero__T(pGetCoeff(p), r->cf))
58  {
59  n_Delete__T(&pGetCoeff(p), r->cf);
60  pIter(bucket->buckets[j]);
61  p_FreeBinAddr(p, r);
62  (bucket->buckets_length[j])--;
63  }
64  j = i;
65  goto Continue;
66  }
67 
68  Equal:
69  {
70  MULTIPLY_BUCKET(bucket,i);
71  number tn = pGetCoeff(p);
72  #if 0
73  pSetCoeff0(p, n_Add__T(pGetCoeff(bucket->buckets[i]), tn, r->cf));
74  n_Delete__T(&tn, r->cf);
75  #else
76  n_InpAdd__T(tn,pGetCoeff(bucket->buckets[i]), r->cf);
77  pSetCoeff0(p, tn);
78  #endif
79  p = bucket->buckets[i];
80  pIter(bucket->buckets[i]);
81  n_Delete__T(&pGetCoeff(p), r->cf);
82  p_FreeBinAddr(p, r);
83  (bucket->buckets_length[i])--;
84  }
85 
86  Continue:;
87  }
88  }
89  p = bucket->buckets[j];
90  if (j > 0 && n_IsZero__T(pGetCoeff(p), r->cf))
91  {
92  n_Delete__T(&pGetCoeff(p), r->cf);
93  pIter(bucket->buckets[j]);
94  p_FreeBinAddr(p, r);
95  (bucket->buckets_length[j])--;
96  j = -1;
97  }
98  }
99  while (j < 0);
100 
101  if (j == 0)
102  {
103  return;
104  }
105 
106  assume(bucket->buckets[j] != NULL);
107  lt = bucket->buckets[j];
108  bucket->buckets[j] = pNext(lt);
109  bucket->buckets_length[j]--;
110  pNext(lt) = NULL;
111  bucket->buckets[0] = lt;
112  bucket->buckets_length[0] = 1;
113 
114  kBucketAdjustBucketsUsed(bucket);
115 }
int i
Definition: cfEzgcd.cc:125
int p
Definition: cfModGcd.cc:4019
int j
Definition: facHensel.cc:105
static BOOLEAN Equal(number a, number b, const coeffs r)
Definition: flintcf_Q.cc:323
static bool Greater(mono_type m1, mono_type m2)
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
ring bucket_ring
Definition: kbuckets.h:192
#define assume(x)
Definition: mod2.h:390
#define p_FreeBinAddr(p, r)
Definition: monomials.h:256
#define pIter(p)
Definition: monomials.h:38
#define pNext(p)
Definition: monomials.h:37
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
#define pSetCoeff0(p, n)
Definition: monomials.h:60
#define NULL
Definition: omList.c:10
#define MULTIPLY_BUCKET(B, I)
#define n_Delete__T(n, r)
Definition: p_polys.cc:4796