source: git/kernel/p_Mult_mm__T.cc @ a48e19

spielwiese
Last change on this file since a48e19 was a48e19, checked in by Oliver Wienand <wienand@…>, 18 years ago
[oliver] p_Mult_mm__T.cc: * Typo corrected ringgb.cc: * deactivated status output * deactivated bound on reduction steps (done to use old reduction routines to test groebner algo) git-svn-id: file:///usr/local/Singular/svn/trunk@9189 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/***************************************************************
5 *  File:    p_Mult_mm__Template.cc
6 *  Purpose: template for p_Mult_n
7 *  Author:  obachman (Olaf Bachmann)
8 *  Created: 8/00
9 *  Version: $Id: p_Mult_mm__T.cc,v 1.4 2006-06-08 18:00:34 wienand Exp $
10 *******************************************************************/
11
12/***************************************************************
13 *
14 *   Returns:  p*m
15 *   Const:    m
16 *   Destroys: p
17 *
18 ***************************************************************/
19LINKAGE poly p_Mult_mm(poly p, const poly m, const ring ri)
20{
21  poly before = p;
22  p_Test(p, ri);
23  p_LmTest(m, ri);
24  if (p == NULL) return NULL;
25  pAssume(m != NULL);
26  poly q = p;
27  number ln = pGetCoeff(m);
28  number pn;
29  DECLARE_LENGTH(const unsigned long length = ri->ExpL_Size);
30  const unsigned long* m_e = m->exp;
31  pAssume(!n_IsZero(ln,ri));
32
33  while (p != NULL)
34  {
35    pn = pGetCoeff(p);
36    number tmp = n_Mult(ln, pn, ri);
37#ifdef HAVE_RING2TOM
38    if (n_IsZero(tmp, ri))
39    {
40      if (before == p)
41      {
42        p = pNext(p);
43        before = p;
44        q = p;
45      }
46      else
47      {
48        pNext(before) = pNext(p);
49        p_LmFree(p, ri);
50        p = pNext(before);
51      }
52    }
53    else
54#endif
55    {
56      pSetCoeff0(p, tmp);
57      n_Delete(&pn, ri);
58      p_MemAdd(p->exp, m_e, length);
59      p_MemAddAdjust(p, ri);
60#ifdef HAVE_RING2TOM
61      before = p;
62#endif
63      p = pNext(p);
64    }
65  }
66  p_Test(q, ri);
67  return q;
68}
69
70
Note: See TracBrowser for help on using the repository browser.