source: git/libpolys/polys/templates/pp_Mult_mm__T.cc @ 6909cfb

spielwiese
Last change on this file since 6909cfb was f224d85, checked in by Hans Schoenemann <hannes@…>, 12 years ago
fix: removing last from p_*templates and k* routines
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/***************************************************************
5 *  File:    pp_Mult_mm__Template.cc
6 *  Purpose: template for p_Mult_n
7 *  Author:  obachman (Olaf Bachmann)
8 *  Created: 8/00
9 *******************************************************************/
10
11/***************************************************************
12 *
13 *   Returns:  p*m
14 *   Const:    p, m
15 *
16 ***************************************************************/
17LINKAGE poly pp_Mult_mm__T(poly p, const poly m, const ring ri)
18{
19  p_Test(p, ri);
20  p_LmTest(m, ri);
21  if (p == NULL)
22  {
23    return NULL;
24  }
25  spolyrec rp;
26#ifdef HAVE_ZERODIVISORS
27  rp.next = NULL;
28#endif
29  poly q = &rp;
30  number ln = pGetCoeff(m);
31  omBin bin = ri->PolyBin;
32  DECLARE_LENGTH(const unsigned long length = ri->ExpL_Size);
33  const unsigned long* m_e = m->exp;
34  pAssume(!n_IsZero__T(ln,ri));
35  pAssume1(p_GetComp(m, ri) == 0 || p_MaxComp(p, ri) == 0);
36  number tmp;
37
38  do
39  {
40    tmp = n_Mult__T(ln, pGetCoeff(p), ri);
41#ifdef HAVE_ZERODIVISORS
42    if (! n_IsZero__T(tmp, ri))
43    {
44#endif
45      p_AllocBin( pNext(q), bin, ri);
46      q = pNext(q);
47      pSetCoeff0(q, tmp);
48      p_MemSum__T(q->exp, p->exp, m_e, length);
49      p_MemAddAdjust__T(q, ri);
50#ifdef HAVE_ZERODIVISORS
51    }
52    else n_Delete__T(&tmp, ri);
53#endif
54    p = pNext(p);
55  }
56  while (p != NULL);
57  pNext(q) = NULL;
58
59  p_Test(pNext(&rp), ri);
60  return pNext(&rp);
61}
62
63
Note: See TracBrowser for help on using the repository browser.