Loading...
Searching...
No Matches
p_Mult_mm__T.cc File Reference

Go to the source code of this file.

## Functions

LINKAGE poly | p_Mult_mm__T (poly p, const poly m, const ring ri)

## Function Documentation

## p_Mult_mm__T()

LINKAGE poly p_Mult_mm__T | ( | poly | p,
|  | const poly | m,
|  | const ring | ri )

Definition at line 18 of file p_Mult_mm__T.cc.

{
p_Test(p, ri);
p_LmTest(m, ri);
pAssume(m != NULL);
assume(p!=NULL);
poly q = p;
number ln = pGetCoeff(m);
number pn;
DECLARE_LENGTH(const unsigned long length = ri->ExpL_Size);
const unsigned long* m_e = m->exp;
pAssume(!n_IsZero__T(ln,ri->cf));
#ifdef HAVE_ZERODIVISORS
poly before = p;
#endif
while (p != NULL)
{
pn = pGetCoeff(p);
number tmp = n_Mult__T(ln, pn, ri->cf);
#ifdef HAVE_ZERODIVISORS
if (n_IsZero__T(tmp, ri->cf))
{
n_Delete__T(&tmp, ri->cf);
if (before == p)
{
p = p_LmDeleteAndNext(p, ri);
before = p;
q = p;
}
else
{
p = p_LmDeleteAndNext(p, ri);
pNext(before) = p;
}
}
else
#endif
{
pSetCoeff0(p, tmp);
n_Delete__T(&pn, ri->cf);
p_MemAdd__T(p->exp, m_e, length);
p_MemAddAdjust__T(p, ri);
#ifdef HAVE_ZERODIVISORS
before = p;
#endif
p = pNext(p);
}
}
p_Test(q, ri);
return q;
}
m
int m
Definition cfEzgcd.cc:128
p
int p
Definition cfModGcd.cc:4086
length
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
assume
#define assume(x)
Definition mod2.h:389
pNext
#define pNext(p)
Definition monomials.h:36
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
pGetCoeff
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
pAssume
#define pAssume(cond)
Definition monomials.h:90
NULL
#define NULL
Definition omList.c:12
n_Delete__T
#define n_Delete__T(n, r)
Definition p_polys.cc:5042
p_LmDeleteAndNext
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition p_polys.h:757
p_LmTest
#define p_LmTest(p, r)
Definition p_polys.h:162
p_Test
#define p_Test(p, r)
Definition p_polys.h:161