source: git/Singular/pp_Mult_mm_Noether__T.cc @ 558209

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