My Project
Loading...
Searching...
No Matches
Functions
pp_Mult_nn__T.cc File Reference

Go to the source code of this file.

Functions

LINKAGE poly pp_Mult_nn__T (poly p, const number n, const ring r)
 

Function Documentation

◆ pp_Mult_nn__T()

LINKAGE poly pp_Mult_nn__T ( poly  p,
const number  n,
const ring  r 
)

Definition at line 17 of file pp_Mult_nn__T.cc.

18{
19 pAssume(!n_IsZero__T(n,r->cf));
20 p_Test(p, r);
21 if (p == NULL) return NULL;
22 spolyrec rp;
23#ifdef HAVE_ZERODIVISORS
24 rp.next = NULL;
25#endif
26 poly q = &rp;
27 omBin bin = r->PolyBin;
28 DECLARE_LENGTH(const unsigned long length = r->ExpL_Size);
29
30 do
31 {
32#ifndef HAVE_ZERODIVISORS
33 p_AllocBin(pNext(q), bin, r);
34 pIter(q);
35 number nc = pGetCoeff(p);
36 pSetCoeff0(q, n_Mult__T(n, nc, r->cf));
37 p_MemCopy__T(q->exp, p->exp, length);
38#else
39 number nc = pGetCoeff(p);
40 number tmp = n_Mult__T(n, nc, r->cf);
41 if (! n_IsZero__T(tmp,r->cf))
42 {
43 p_AllocBin(pNext(q), bin, r);
44 pIter(q);
45 pSetCoeff0(q, tmp);
46 p_MemCopy__T(q->exp, p->exp, length);
47 }
48 else
49 n_Delete__T(&tmp,r->cf);
50#endif
51 pIter(p);
52 }
53 while (p != NULL);
54 pNext(q) = NULL;
55
56 p_Test(rp.next, r);
57 return rp.next;
58}
int p
Definition: cfModGcd.cc:4078
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:257
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
#define n_Delete__T(n, r)
Definition: p_polys.cc:4841
#define p_Test(p, r)
Definition: p_polys.h:159