source: git/kernel/pp_Mult_mm__T.cc @ fec53d

fieker-DuValspielwiese
Last change on this file since fec53d was 341696, checked in by Hans Schönemann <hannes@…>, 15 years ago
Adding Id property to all files git-svn-id: file:///usr/local/Singular/svn/trunk@12231 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • 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 *  Version: $Id$
10 *******************************************************************/
11
12/***************************************************************
13 *
14 *   Returns:  p*m
15 *   Const:    p, m
16 *
17 ***************************************************************/
18LINKAGE poly pp_Mult_mm(poly p, const poly m, const ring ri, poly &last)
19{
20  p_Test(p, ri);
21  p_LmTest(m, ri);
22  if (p == NULL)
23  {
24    last = NULL;     
25    return NULL;
26  }
27  spolyrec rp;
28#ifdef HAVE_ZERODIVISORS
29  rp.next = NULL;
30#endif
31  poly q = &rp, r;
32  number ln = pGetCoeff(m);
33  omBin bin = ri->PolyBin;
34  DECLARE_LENGTH(const unsigned long length = ri->ExpL_Size);
35  const unsigned long* m_e = m->exp;
36  pAssume(!n_IsZero(ln,ri));
37  pAssume1(p_GetComp(m, ri) == 0 || p_MaxComp(p, ri) == 0);
38  number tmp;
39
40  do
41  {
42    tmp = n_Mult(ln, pGetCoeff(p), ri);
43#ifdef HAVE_ZERODIVISORS
44    if (! n_IsZero(tmp, ri))
45    {
46#endif
47      p_AllocBin( pNext(q), bin, ri);
48      q = pNext(q);
49      pSetCoeff0(q, tmp);
50      p_MemSum(q->exp, p->exp, m_e, length);
51      p_MemAddAdjust(q, ri);
52#ifdef HAVE_ZERODIVISORS
53    }
54    else n_Delete(&tmp, ri);
55#endif
56    p = pNext(p);
57  }
58  while (p != NULL);
59  last = q;
60  pNext(q) = NULL;
61
62  p_Test(pNext(&rp), ri);
63  return pNext(&rp);
64}
65
66
Note: See TracBrowser for help on using the repository browser.