source: git/kernel/pp_Mult_Coeff_mm_DivSelectMult__T.cc @ eab144e

spielwiese
Last change on this file since eab144e 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: 2.3 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/***************************************************************
5 *  File:    pp_Mult_Coeff_mm_DivSelectMult__Template.cc
6 *  Purpose: template for pp_Mult_Coeff_mm__DivSelectMult
7 *  Author:  obachman (Olaf Bachmann)
8 *  Created: 8/00
9 *  Version: $Id: pp_Mult_Coeff_mm_DivSelectMult__T.cc,v 1.1.1.1 2003-10-06 12:16:01 Singular Exp $
10 *******************************************************************/
11
12/***************************************************************
13 *
14 *   Returns:  p*Coeff(m)*a/b for such monomials pm of p, for which
15 *             m is divisble by pm, shorter == #of monomials left out
16 *   Assumes:  m, a, b are monomials, ordering is (c, dp),
17 *            (p*a) is divisble by b for all monimials in question
18 *   Const:    p, m, a, b
19 *
20 ***************************************************************/
21LINKAGE poly pp_Mult_Coeff_mm_DivSelectMult
22  (poly p,const poly m, const poly a, const poly b, int &shorter,const ring r)
23{
24  assume(rOrd_is_Comp_dp(r) && r->ExpL_Size > 2);
25  p_Test(p, r);
26  if (p == NULL) return NULL;
27  number n = pGetCoeff(m);
28  number nc;
29  pAssume(!n_IsZero(n,r));
30
31  spolyrec rp;
32  omBin bin = r->PolyBin;
33  const unsigned long bitmask = r->divmask;
34  const unsigned long* m_e = &(m->exp[2]);
35  DECLARE_LENGTH(const unsigned long length = r->ExpL_Size);
36  DECLARE_LENGTH_2(const unsigned long length_2 = length - 2);
37
38  poly ab;
39  p_AllocBin(ab, bin, r);
40  unsigned long* ab_e = &(ab->exp[0]);
41
42  p_MemDiff(ab_e, ((unsigned long*) &(a->exp[0])), ((unsigned long*) &(b->exp[0])),
43            length);
44
45  int Shorter = 0;
46  poly q = &rp;
47
48  do
49  {
50    p_MemCmp_Bitmask_2(m_e, &(p->exp[2]), bitmask, length_2,
51                       goto Divisible, goto NotDivisible);
52
53    NotDivisible:
54    pAssume(!p_LmDivisibleByNoComp(m, p, r));
55    Shorter++;
56    goto Iter;
57
58    Divisible:
59    pAssume(p_LmDivisibleByNoComp(m, p, r));
60    p_AllocBin(pNext(q), bin, r);
61    q = pNext(q);
62    nc = pGetCoeff(p);
63    pSetCoeff0(q, n_Mult(n, nc, r));
64    p_MemSum(q->exp, p->exp, ab_e, length);
65
66    Iter:
67    pIter(p);
68  }
69  while (p != NULL);
70
71  pNext(q) = NULL;
72  p_FreeBinAddr(ab, r);
73
74  shorter = Shorter;
75  p_Test(rp.next, r);
76  return rp.next;
77}
78
79
Note: See TracBrowser for help on using the repository browser.