source: git/libpolys/polys/templates/pp_Mult_Coeff_mm_DivSelect__T.cc @ 6ce030f

spielwiese
Last change on this file since 6ce030f 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.4 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 *******************************************************************/
10
11/***************************************************************
12 *
13 *   Returns:  p*Coeff(m) for such monomials pm of p, for which
14 *             m is divisble by pm
15 *   Const:    p, m
16 *
17 ***************************************************************/
18LINKAGE poly pp_Mult_Coeff_mm_DivSelect__T(poly p, const poly m, int &shorter,
19                                        const ring r)
20{
21  number n = pGetCoeff(m);
22  pAssume(!n_IsZero__T(n,r));
23  p_Test(p, r);
24  if (p == NULL) return NULL;
25  spolyrec rp;
26  DECLARE_LENGTH(const unsigned long length = r->ExpL_Size);
27  int Shorter = 0;
28  poly q = &rp;
29  omBin bin = r->PolyBin;
30
31  do
32  {
33    if (p_LmDivisibleByNoComp(m, p, r))
34    {
35      p_AllocBin(pNext(q), bin, r);
36      q = pNext(q);
37      number nc = pGetCoeff(p);
38      pSetCoeff0(q, n_Mult__T(n, nc, r));
39      p_MemCopy__T(q->exp, p->exp, length);
40    }
41    else
42    {
43      Shorter++;
44    }
45    pIter(p);
46  }
47  while (p != NULL);
48  pNext(q) = NULL;
49
50  shorter = Shorter;
51  p_Test(rp.next, r);
52  return rp.next;
53}
54
55
Note: See TracBrowser for help on using the repository browser.