My Project
Loading...
Searching...
No Matches
pp_Mult_Coeff_mm_DivSelect__T.cc
Go to the documentation of this file.
1/****************************************
2* Computer Algebra System SINGULAR *
3****************************************/
4/***************************************************************
5 * File: pp_Mult_Coeff_mm_DivSelect__Template.cc
6 * Purpose: template for pp_Mult_Coeff_mm__DivSelect
7 * Author: obachman (Olaf Bachmann)
8 * Created: 8/00
9 *******************************************************************/
10
11/***************************************************************
12 *
13 * Returns: p*Coeff(m) for such monomials pm of p, for which
14 * m is divisble by pm
15 * Const: p, m
16 *
17 ***************************************************************/
18LINKAGE poly pp_Mult_Coeff_mm_DivSelect__T(poly p, const poly m, int &shorter,
19 const ring r)
20{
21 number n = pGetCoeff(m);
22 pAssume(!n_IsZero__T(n,r->cf));
23 p_Test(p, r);
24 if (p == NULL) return NULL;
25 spolyrec rp;
26 DECLARE_LENGTH(const unsigned long length = r->ExpL_Size);
27 int Shorter = 0;
28 poly q = &rp;
29 omBin bin = r->PolyBin;
30
31 do
32 {
33 if (p_LmDivisibleByNoComp(m, p, r))
34 {
35 p_AllocBin(pNext(q), bin, r);
36 q = pNext(q);
37 number nc = pGetCoeff(p);
38 pSetCoeff0(q, n_Mult__T(n, nc, r->cf));
39 p_MemCopy__T(q->exp, p->exp, length);
40 }
41 else
42 {
43 Shorter++;
44 }
45 pIter(p);
46 }
47 while (p != NULL);
48 pNext(q) = NULL;
49
50 shorter = Shorter;
51 p_Test(rp.next, r);
52 return rp.next;
53}
54
55
int m
Definition: cfEzgcd.cc:128
int p
Definition: cfModGcd.cc:4078
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:257
#define LINKAGE
Definition: mod2.h:140
poly next
Definition: monomials.h:24
#define pIter(p)
Definition: monomials.h:37
#define pNext(p)
Definition: monomials.h:36
#define pSetCoeff0(p, n)
Definition: monomials.h:59
#define p_AllocBin(p, bin, r)
Definition: monomials.h:248
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
#define pAssume(cond)
Definition: monomials.h:90
#define NULL
Definition: omList.c:12
omBin_t * omBin
Definition: omStructs.h:12
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
Definition: p_polys.h:1875
#define p_Test(p, r)
Definition: p_polys.h:159
LINKAGE poly pp_Mult_Coeff_mm_DivSelect__T(poly p, const poly m, int &shorter, const ring r)