source: git/kernel/p_Mult_nn__T.cc @ fe7f527

spielwiese
Last change on this file since fe7f527 was fe7f527, checked in by Oliver Wienand <wienand@…>, 18 years ago
p_Mult_nn__T.cc: --> Leitkoeff wird 0 nun korrekt kstd2.cc: --> Koeffizientenreduktion deaktiviert --> kleinere Änderungen, mehr Kosmetik git-svn-id: file:///usr/local/Singular/svn/trunk@8992 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.2 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/***************************************************************
5 *  File:    p_Mult_n__Template.cc
6 *  Purpose: template for p_Mult_n
7 *  Author:  obachman (Olaf Bachmann)
8 *  Created: 8/00
9 *  Version: $Id: p_Mult_nn__T.cc,v 1.5 2006-02-28 17:50:33 wienand Exp $
10 *******************************************************************/
11
12/***************************************************************
13 *
14 *   Returns:  p*n
15 *   Destroys: p
16 *   Const:    n
17 *
18 ***************************************************************/
19LINKAGE poly p_Mult_nn(poly p, const number n, const ring r)
20{
21  pAssume(!n_IsZero(n,r));
22  p_Test(p, r);
23
24  poly q = p;
25  while (p != NULL)
26  {
27#ifndef HAVE_RING2TOM
28    number nc = pGetCoeff(p);
29    pSetCoeff0(p, n_Mult(n, nc, r));
30    n_Delete(&nc, r);
31    pIter(p);
32#else
33    number tmp = n_Mult(n, pGetCoeff(p), r);
34    if (r->cring==0 || (r->cring ==1 && tmp != NULL))
35    {
36       p_SetCoeff(p, tmp, r);
37       pIter(p);
38    }
39    else
40    {
41      n_Delete(&tmp, r);
42      if (p == q) { q = pNext(q); }
43      p = pNext(p);    // TODO Free Monom OLIVER
44    }
45#endif
46  }
47  p_Test(q, r);
48  return q;
49}
50
51
Note: See TracBrowser for help on using the repository browser.