source:git/kernel/pp_Mult_nn__T.cc@cea6f3

spielwiese
Last change on this file since cea6f3 was cea6f3, checked in by Oliver Wienand <wienand@…>, 18 years ago
• Property mode set to `100644`
File size: 1.3 KB
Line
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/***************************************************************
5 *  File:    pp_Mult_nn__Template.cc
6 *  Purpose: template for pp_Mult_nn
7 *  Author:  obachman (Olaf Bachmann)
8 *  Created: 8/00
9 *  Version: \$Id: pp_Mult_nn__T.cc,v 1.2 2006-01-13 18:10:05 wienand Exp \$
10 *******************************************************************/
11
12/***************************************************************
13 *
14 *   Returns:  p*n
15 *   Const:    p, n
16 *
17 ***************************************************************/
18LINKAGE poly pp_Mult_nn(poly p, const number n, const ring r)
19{
20  pAssume(!n_IsZero(n,r));
21  p_Test(p, r);
22  if (p == NULL) return NULL;
23  spolyrec rp;
24  poly q = &rp;
25  omBin bin = r->PolyBin;
26  DECLARE_LENGTH(const unsigned long length = r->ExpL_Size);
27
28  do
29  {
30    number nc = pGetCoeff(p);
31    number tmp = n_Mult(n, nc, r);
32#ifdef HAVE_RING2TOM
33    if (r->cring==0 || (r->cring ==1 && (long) tmp != 0)){
34#endif
35      p_AllocBin(pNext(q), bin, r);
36      q = pNext(q);
37      pSetCoeff0(q, tmp);
38      p_MemCopy(q->exp, p->exp, length);
39#ifdef HAVE_RING2TOM
40    }
41#endif
42    pIter(p);
43  }
44  while (p != NULL);
45  pNext(q) = NULL;
46
47  p_Test(rp.next, r);
48  return rp.next;
49}
50
51
Note: See TracBrowser for help on using the repository browser.