source: git/libpolys/polys/templates/pp_Mult_mm_Noether__T.cc @ 85bcd6

spielwiese
Last change on this file since 85bcd6 was 6ce030f, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
removal of the $Id$ svn tag from everywhere NOTE: the git SHA1 may be used instead (only on special places) NOTE: the libraries Singular/LIB/*.lib still contain the marker due to our current use of svn
  • Property mode set to 100644
File size: 1.8 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, ll
14 *   ll == pLength(p*m) , if on input ll < 0
15 *   pLength(p) - pLength(p*m), if on input ll >= 0
16 *   Const:    p, m
17 *
18 ***************************************************************/
19LINKAGE poly pp_Mult_mm_Noether__T(poly p, const poly m, const poly spNoether, int &ll, const ring ri, poly &last)
20{
21  p_Test(p, ri);
22  p_LmTest(m, ri);
23  assume(spNoether != NULL);
24  if (p == NULL)
25  {
26    ll = 0;
27    last = NULL;
28    return NULL;
29  }
30  spolyrec rp;
31  poly q = &rp, r;
32  const unsigned long *spNoether_exp = spNoether->exp;
33  number ln = pGetCoeff(m);
34  omBin bin = ri->PolyBin;
35  DECLARE_LENGTH(const unsigned long length = ri->ExpL_Size);
36  DECLARE_ORDSGN(const long* ordsgn = ri->ordsgn);
37  const unsigned long* m_e = m->exp;
38  pAssume(!n_IsZero__T(ln,ri));
39  pAssume1(p_GetComp(m, ri) == 0 || p_MaxComp(p, ri) == 0);
40  int l = 0;
41
42  do
43  {
44    p_AllocBin(r, bin, ri);
45    p_MemSum__T(r->exp, p->exp, m_e, length);
46    p_MemAddAdjust__T(r, ri);
47
48    p_MemCmp__T(r->exp, spNoether_exp, length, ordsgn, goto Continue, goto Continue, goto Break);
49
50    Break:
51    p_FreeBinAddr(r, ri);
52    break;
53
54    Continue:
55    l++;
56    q = pNext(q) = r;
57    pSetCoeff0(q, n_Mult__T(ln, pGetCoeff(p), ri));
58    pIter(p);
59  } while (p != NULL);
60
61  if (ll < 0)
62    ll = l;
63  else
64    ll = pLength(p);
65
66  if (q != &rp)
67    last = q;
68  pNext(q) = NULL;
69
70  p_Test(pNext(&rp), ri);
71  return pNext(&rp);
72}
73
74
Note: See TracBrowser for help on using the repository browser.