pp_Mult_mm_Noether__T.cc
Go to the documentation of this file.
1 /****************************************
2 * Computer Algebra System SINGULAR *
3 ****************************************/
4 /***************************************************************
5  * File: pp_Mult_mm__Template.cc
6  * Purpose: template for p_Mult_n
7  * Author: obachman (Olaf Bachmann)
8  * Created: 8/00
9  *******************************************************************/
10 
11 /***************************************************************
12  *
13  * Returns: p*m, ll
14  * ll == pLength(p*m) , if on input ll < 0
15  * pLength(p) - pLength(p*m), if on input ll >= 0
16  * Const: p, m
17  *
18  ***************************************************************/
19 LINKAGE poly pp_Mult_mm_Noether__T(poly p, const poly m, const poly spNoether, int &ll, const ring ri)
20 {
21  p_Test(p, ri);
22  p_LmTest(m, ri);
23  assume(spNoether != NULL);
24  if (p == NULL)
25  {
26  ll = 0;
27  return NULL;
28  }
29  spolyrec rp;
30  poly q = &rp, r;
31  number n;
32  const unsigned long *spNoether_exp = spNoether->exp;
33  number ln = pGetCoeff(m);
34  omBin bin = ri->PolyBin;
35  DECLARE_LENGTH(const unsigned long length = ri->ExpL_Size);
36  DECLARE_ORDSGN(const long* ordsgn = ri->ordsgn);
37  const unsigned long* m_e = m->exp;
38  pAssume(!n_IsZero__T(ln,ri->cf));
39  pAssume1(p_GetComp(m, ri) == 0 || p_MaxComp(p, ri) == 0);
40  int l = 0;
41 
42  do
43  {
44  p_AllocBin(r, bin, ri);
45  p_MemSum__T(r->exp, p->exp, m_e, length);
46  p_MemAddAdjust__T(r, ri);
47 
48  p_MemCmp__T(r->exp, spNoether_exp, length, ordsgn, goto Continue, goto Continue, goto Break);
49 
50  Break:
51  p_FreeBinAddr(r, ri);
52  break;
53 
54  Continue:
55 
56  n = n_Mult__T(ln, pGetCoeff(p), ri->cf);
57 
58  #ifdef HAVE_RINGS
59  if(n_IsZero__T(n, ri->cf))
60  {
61  n_Delete__T(&n, ri->cf);
62  p_FreeBinAddr(r, ri);
63  } else
64  #endif
65  {
66  l++;
67  q = pNext(q) = r;
68  pSetCoeff0(q, n);
69  }
70 
71  pIter(p);
72 
73  } while (p != NULL);
74 
75  if (ll < 0)
76  ll = l;
77  else
78  ll = pLength(p);
79 
80  pNext(q) = NULL;
81 
82  p_Test(pNext(&rp), ri);
83  return pNext(&rp);
84 }
85 
86 
omBin_t * omBin
Definition: omStructs.h:12
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
#define p_GetComp(p, r)
Definition: monomials.h:72
#define LINKAGE
Definition: mod2.h:153
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define p_AllocBin(p, bin, r)
Definition: monomials.h:256
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static int pLength(poly a)
Definition: p_polys.h:189
#define pIter(p)
Definition: monomials.h:44
#define p_FreeBinAddr(p, r)
Definition: monomials.h:263
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
#define n_Delete__T(n, r)
Definition: p_polys.cc:4676
int m
Definition: cfEzgcd.cc:119
#define p_LmTest(p, r)
Definition: p_polys.h:161
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
#define pAssume1(cond)
Definition: monomials.h:179
LINKAGE poly pp_Mult_mm_Noether__T(poly p, const poly m, const poly spNoether, int &ll, const ring ri)
int l
Definition: cfEzgcd.cc:94
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:281