source: git/kernel/pp_Mult_Coeff_mm_DivSelect__T.cc @ 788529d

spielwiese
Last change on this file since 788529d was 35aab3, checked in by Hans Schönemann <hannes@…>, 20 years ago
This commit was generated by cvs2svn to compensate for changes in r6879, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@6880 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.5 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/***************************************************************
5 *  File:    pp_Mult_Coeff_mm_DivSelect__Template.cc
6 *  Purpose: template for pp_Mult_Coeff_mm__DivSelect
7 *  Author:  obachman (Olaf Bachmann)
8 *  Created: 8/00
9 *  Version: $Id: pp_Mult_Coeff_mm_DivSelect__T.cc,v 1.1.1.1 2003-10-06 12:16:02 Singular Exp $
10 *******************************************************************/
11
12/***************************************************************
13 *
14 *   Returns:  p*Coeff(m) for such monomials pm of p, for which
15 *             m is divisble by pm
16 *   Const:    p, m
17 *
18 ***************************************************************/
19LINKAGE poly pp_Mult_Coeff_mm_DivSelect(poly p, const poly m, int &shorter,
20                                        const ring r)
21{
22  number n = pGetCoeff(m);
23  pAssume(!n_IsZero(n,r));
24  p_Test(p, r);
25  if (p == NULL) return NULL;
26  spolyrec rp;
27  DECLARE_LENGTH(const unsigned long length = r->ExpL_Size);
28  int Shorter = 0;
29  poly q = &rp;
30  omBin bin = r->PolyBin;
31
32  do
33  {
34    if (p_LmDivisibleByNoComp(m, p, r))
35    {
36      p_AllocBin(pNext(q), bin, r);
37      q = pNext(q);
38      number nc = pGetCoeff(p);
39      pSetCoeff0(q, n_Mult(n, nc, r));
40      p_MemCopy(q->exp, p->exp, length);
41    }
42    else
43    {
44      Shorter++;
45    }
46    pIter(p);
47  }
48  while (p != NULL);
49  pNext(q) = NULL;
50
51  shorter = Shorter;
52  p_Test(rp.next, r);
53  return rp.next;
54}
55
56
Note: See TracBrowser for help on using the repository browser.