Loading...
Searching...
No Matches
pp_Mult_mm__T.cc
Go to the documentation of this file.
/****************************************
* Computer Algebra System SINGULAR *
****************************************/
/***************************************************************
* File: pp_Mult_mm__Template.cc
* Purpose: template for p_Mult_n
* Author: obachman (Olaf Bachmann)
* Created: 8/00
*******************************************************************/
/***************************************************************
*
* Returns: p*m
* Const: p, m
*
***************************************************************/
LINKAGE poly pp_Mult_mm__T(poly p, const poly m, const ring ri)
{
p_Test(p, ri);
p_LmTest(m, ri);
if (p == NULL)
{
return NULL;
}
spolyrec rp;
#ifdef HAVE_ZERODIVISORS
rp.next = NULL;
#endif
poly q = &rp;
number ln = pGetCoeff(m);
omBin bin = ri->PolyBin;
DECLARE_LENGTH(const unsigned long length = ri->ExpL_Size);
const unsigned long* m_e = m->exp;
pAssume(!n_IsZero__T(ln,ri->cf));
pAssume1(p_GetComp(m, ri) == 0 || p_MaxComp(p, ri) == 0);
number tmp;
do
{
tmp = n_Mult__T(ln, pGetCoeff(p), ri->cf);
#ifdef HAVE_ZERODIVISORS
if (! n_IsZero__T(tmp, ri->cf))
{
#endif
p_AllocBin( pNext(q), bin, ri);
q = pNext(q);
pSetCoeff0(q, tmp);
p_MemSum__T(q->exp, p->exp, m_e, length);
p_MemAddAdjust__T(q, ri);
#ifdef HAVE_ZERODIVISORS
}
else n_Delete__T(&tmp, ri->cf);
#endif
p = pNext(p);
}
while (p != NULL);
pNext(q) = NULL;
p_Test(pNext(&rp), ri);
return pNext(&rp);
}
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
LINKAGE
#define LINKAGE
Definition mod2.h:140
p_GetComp
#define p_GetComp(p, r)
Definition monomials.h:64
spolyrec::next
poly next
Definition monomials.h:24
pNext
#define pNext(p)
Definition monomials.h:36
pAssume1
#define pAssume1(cond)
Definition monomials.h:171
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
p_AllocBin
#define p_AllocBin(p, bin, r)
Definition monomials.h:210
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
spolyrec
Definition monomials.h:23
NULL
#define NULL
Definition omList.c:12
omBin
omBin_t * omBin
Definition omStructs.h:12
n_Delete__T
#define n_Delete__T(n, r)
Definition p_polys.cc:5042
p_MaxComp
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition p_polys.h:294
p_LmTest
#define p_LmTest(p, r)
Definition p_polys.h:162
p_Test
#define p_Test(p, r)
Definition p_polys.h:161
pp_Mult_mm__T
LINKAGE poly pp_Mult_mm__T(poly p, const poly m, const ring ri)
Definition pp_Mult_mm__T.cc:17