source: git/Singular/p_Mult_m__Template.cc @ 64eef3

fieker-DuValspielwiese
Last change on this file since 64eef3 was 9d72fe, checked in by Olaf Bachmann <obachman@…>, 24 years ago
* new p_Procs stuff git-svn-id: file:///usr/local/Singular/svn/trunk@4559 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_m__Template.cc
6 *  Purpose: template for p_Mult_n
7 *  Author:  obachman (Olaf Bachmann)
8 *  Created: 8/00
9 *  Version: $Id: p_Mult_m__Template.cc,v 1.1 2000-08-24 14:42:43 obachman Exp $
10 *******************************************************************/
11
12/***************************************************************
13 *
14 *   Returns:  p*m
15 *   Const:    p, m
16 *   If spNoether != NULL, then monoms which are smaller
17 *   then spNoether are cut
18 *
19 ***************************************************************/
20poly p_Mult_m(poly p, const poly m, const poly spNoether, const ring ri)
21{
22  if (p == NULL) return NULL;
23  spolyrec rp;
24  poly q = &rp, r;
25  number ln = pGetCoeff(m);
26  omBin bin = ri->PolyBin;
27  DECLARE_LENGTH(const unsigned long length = ri->ExpLSize);
28  const unsigned long* m_e = m->exp.l;
29
30  if (spNoether == NULL)
31  {
32    while (p != NULL)
33    {
34      omTypeAllocBin(poly, pNext(q), bin);
35      q = pNext(q);
36      pSetCoeff0(q, p_nMult(ln, pGetCoeff(p), ri));
37      p_MemAdd(q->exp.l, p->exp.l, m_e, length);
38      p = pNext(p);
39    }
40  }
41  else
42  {
43    poly r;
44    while (p != NULL)
45    {
46      omTypeAllocBin(poly, r, bin);
47      p_MemAdd(r->exp.l, p->exp.l, m_e, length);
48
49      if (prComp0(r, spNoether, ri) == -1)
50      {
51        omFreeBinAddr(r);
52        break;
53      }
54      q = pNext(q) = r;
55      pSetCoeff0(q, p_nMult(ln, pGetCoeff(p), ri));
56      pIter(p);
57    }
58  }
59  pNext(q) = NULL;
60
61  return pNext(&rp);
62}
63
64
Note: See TracBrowser for help on using the repository browser.