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

Go to the source code of this file.

Functions

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

Function Documentation

◆ p_Mult_nn__T()

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

Definition at line 18 of file p_Mult_nn__T.cc.

19{
20 pAssume(!n_IsZero__T(n,r->cf));
21 p_Test(p, r);
22
23 poly q = p;
24#ifdef HAVE_ZERODIVISORS
25 poly old = NULL;
26#endif
27 while (p!=NULL)
28 {
29#ifndef HAVE_ZERODIVISORS
30 n_InpMult__T(pGetCoeff(p), n, r->cf);
31 pIter(p);
32#else
33 number tmp = n_Mult__T(n, pGetCoeff(p), r->cf);
34 if (!n_IsZero__T(tmp,r->cf))
35 {
36 number nc = pGetCoeff(p);
37 p_SetCoeff0(p, tmp, r);
38 n_Delete__T(&nc, r->cf);
39 old = p;
40 pIter(p);
41 }
42 else
43 {
44 n_Delete__T(&tmp, r->cf);
45 if (old == NULL)
46 {
47 pIter(p);
48 p_LmDelete(&q, r);
49 }
50 else
51 {
52 p_LmDelete(&p, r);
53 pNext(old) = p;
54 }
55 }
56#endif
57 }
58 p_Test(q, r);
59 return q;
60}
int p
Definition: cfModGcd.cc:4078
#define p_SetCoeff0(p, n, r)
Definition: monomials.h:60
#define pIter(p)
Definition: monomials.h:37
#define pNext(p)
Definition: monomials.h:36
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
#define n_Delete__T(n, r)
Definition: p_polys.cc:4841
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:721
#define p_Test(p, r)
Definition: p_polys.h:159