source: git/Singular/pp_Mult_mm_Noether__Template.cc @ 0224c8

spielwiese
Last change on this file since 0224c8 was a29995, checked in by Olaf Bachmann <obachman@…>, 23 years ago
* towards tailRings for local case git-svn-id: file:///usr/local/Singular/svn/trunk@4777 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.9 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: pp_Mult_mm_Noether__Template.cc,v 1.2 2000-11-28 11:50:56 obachman Exp $
10 *******************************************************************/
11
12/***************************************************************
13 *
14 *   Returns:  p*m, ll
15 *   ll == pLength(p*m) , if on input ll < 0
16 *   pLength(p) - pLength(p*m), if on input ll >= 0
17 *   Const:    p, m
18 *
19 ***************************************************************/
20poly pp_Mult_mm_Noether(poly p, const poly m, const poly spNoether, int &ll, 
21                        const ring ri, poly &last)
22{
23  p_Test(p, ri);
24  p_LmTest(m, ri);
25  assume(spNoether != NULL);
26  if (p == NULL) 
27  {
28    ll = 0;
29    last = NULL;
30    return NULL;
31  }
32  spolyrec rp;
33  poly q = &rp, r;
34  const unsigned long *spNoether_exp = spNoether->exp;
35  number ln = pGetCoeff(m);
36  omBin bin = ri->PolyBin;
37  DECLARE_LENGTH(const unsigned long length = ri->ExpL_Size);
38  DECLARE_ORDSGN(const long* ordsgn = ri->ordsgn);
39  const unsigned long* m_e = m->exp;
40  pAssume(!n_IsZero(ln,ri));
41  pAssume1(p_GetComp(m, ri) == 0 || p_MaxComp(p, ri) == 0);
42  int l = 0;
43 
44  do
45  {
46    p_AllocBin(r, bin, ri);
47    p_MemSum(r->exp, p->exp, m_e, length);
48    p_MemAddAdjust(r, ri);
49
50    p_MemCmp(r->exp, spNoether_exp, length, ordsgn, goto Continue, goto Continue, goto Break);
51   
52    Break:
53    p_FreeBinAddr(r, ri);
54    break;
55
56    Continue:
57    l++;
58    q = pNext(q) = r;
59    pSetCoeff0(q, n_Mult(ln, pGetCoeff(p), ri));
60    pIter(p);
61  } while (p != NULL);
62
63  if (ll < 0)
64    ll = l;
65  else
66    ll = pLength(p);
67 
68  if (q != &rp) 
69    last = q;
70  pNext(q) = NULL;
71
72  p_Test(pNext(&rp), ri);
73  return pNext(&rp);
74}
75
76
Note: See TracBrowser for help on using the repository browser.