spielwiese
Last change
on this file since 1c473f was
af378f7,
checked in by Oliver Wienand <wienand@…>, 16 years ago
|
anpassungen an gmp
git-svn-id: file:///usr/local/Singular/svn/trunk@10538 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[35aab3] | 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 |
---|
[af378f7] | 9 | * Version: $Id: p_Mult_nn__T.cc,v 1.10 2008-01-30 18:49:43 wienand Exp $ |
---|
[35aab3] | 10 | *******************************************************************/ |
---|
| 11 | |
---|
| 12 | /*************************************************************** |
---|
| 13 | * |
---|
| 14 | * Returns: p*n |
---|
| 15 | * Destroys: p |
---|
| 16 | * Const: n |
---|
| 17 | * |
---|
| 18 | ***************************************************************/ |
---|
| 19 | LINKAGE 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; |
---|
[009d80] | 25 | #ifdef HAVE_ZERODIVISORS |
---|
[32ed4f] | 26 | poly old = NULL; |
---|
| 27 | #endif |
---|
[35aab3] | 28 | while (p != NULL) |
---|
| 29 | { |
---|
[009d80] | 30 | #ifndef HAVE_ZERODIVISORS |
---|
[a09a42] | 31 | number nc = pGetCoeff(p); |
---|
| 32 | pSetCoeff0(p, n_Mult(n, nc, r)); |
---|
| 33 | n_Delete(&nc, r); |
---|
| 34 | pIter(p); |
---|
| 35 | #else |
---|
[cea6f3] | 36 | number tmp = n_Mult(n, pGetCoeff(p), r); |
---|
[af378f7] | 37 | if (!nIsZero(tmp)) |
---|
[a09a42] | 38 | { |
---|
[af378f7] | 39 | number nc = pGetCoeff(p); |
---|
| 40 | p_SetCoeff0(p, tmp, r); |
---|
| 41 | n_Delete(&nc, r); |
---|
[32ed4f] | 42 | old = p; |
---|
[cea6f3] | 43 | pIter(p); |
---|
| 44 | } |
---|
[a09a42] | 45 | else |
---|
| 46 | { |
---|
| 47 | n_Delete(&tmp, r); |
---|
[af378f7] | 48 | if (old == NULL) |
---|
| 49 | { |
---|
| 50 | pIter(p); |
---|
| 51 | p_DeleteLm(&q, r); |
---|
| 52 | } |
---|
| 53 | else |
---|
| 54 | { |
---|
| 55 | p_DeleteLm(&p, r); |
---|
| 56 | pNext(old) = p; |
---|
| 57 | } |
---|
[cea6f3] | 58 | } |
---|
| 59 | #endif |
---|
[35aab3] | 60 | } |
---|
| 61 | p_Test(q, r); |
---|
| 62 | return q; |
---|
| 63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.