My Project  debian-1:4.1.1-p2+ds-4build2
Functions
p_Merge_q__T.cc File Reference

Go to the source code of this file.

Functions

LINKAGE poly p_Merge_q__T (poly p, poly q, const ring r)
 

Function Documentation

◆ p_Merge_q__T()

LINKAGE poly p_Merge_q__T ( poly  p,
poly  q,
const ring  r 
)

Definition at line 17 of file p_Merge_q__T.cc.

18 {
19  assume(p != NULL && q != NULL);
20  p_Test(p, r);
21  p_Test(q, r);
22 #if PDEBUG > 0
23  int l = pLength(p) + pLength(q);
24 #endif
25 
26  spolyrec rp;
27  poly a = &rp;
28  DECLARE_LENGTH(const unsigned long length = r->CmpL_Size);
29  DECLARE_ORDSGN(const long* ordsgn = r->ordsgn);
30 
31  Top: // compare p and q w.r.t. monomial ordering
32  p_MemCmp__T(p->exp, q->exp, length, ordsgn, goto Equal, goto Greater , goto Smaller);
33 
34  Equal:
35  // should never get here
36  dReportError("Equal monomials in p_Merge_q");
37  return NULL;
38 
39  Greater:
40  a = pNext(a) = p;
41  pIter(p);
42  if (p==NULL) { pNext(a) = q; goto Finish;}
43  goto Top;
44 
45  Smaller:
46  a = pNext(a) = q;
47  pIter(q);
48  if (q==NULL) { pNext(a) = p; goto Finish;}
49  goto Top;
50 
51  Finish:
52 
53  p_Test(pNext(&rp), r);
54 #if PDEBUG > 0
55  pAssume1(l - pLength(pNext(&rp)) == 0);
56 #endif
57  return pNext(&rp);
58 }
dReportError
int dReportError(const char *fmt,...)
Definition: dError.cc:45
Equal
static BOOLEAN Equal(number a, number b, const coeffs r)
Definition: flintcf_Q.cc:351
length
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:267
p_Test
#define p_Test(p, r)
Definition: p_polys.h:163
pLength
static unsigned pLength(poly a)
Definition: p_polys.h:192
Greater
static bool Greater(mono_type m1, mono_type m2)
Definition: interpolation.cc:285
pIter
#define pIter(p)
Definition: monomials.h:44
spolyrec
Definition: monomials.h:29
pAssume1
#define pAssume1(cond)
Definition: monomials.h:178
assume
#define assume(x)
Definition: mod2.h:390
NULL
#define NULL
Definition: omList.c:10
l
int l
Definition: cfEzgcd.cc:93
p
int p
Definition: cfModGcd.cc:4019
pNext
#define pNext(p)
Definition: monomials.h:43