[35aab3] | 1 | /**************************************** |
---|
| 2 | * Computer Algebra System SINGULAR * |
---|
| 3 | ****************************************/ |
---|
| 4 | /*************************************************************** |
---|
| 5 | * File: pShallowCopyDelete.cc |
---|
| 6 | * Purpose: implementation of pShallowCopyDelete routines |
---|
| 7 | * Author: obachman (Olaf Bachmann) |
---|
| 8 | * Created: 8/00 |
---|
| 9 | * Version: $Id: pShallowCopyDelete.cc,v 1.1.1.1 2003-10-06 12:15:58 Singular Exp $ |
---|
| 10 | *******************************************************************/ |
---|
| 11 | #include "mod2.h" |
---|
| 12 | #include "p_polys.h" |
---|
| 13 | #include "ring.h" |
---|
| 14 | #include "pShallowCopyDelete.h" |
---|
| 15 | |
---|
| 16 | // a simple implementations |
---|
| 17 | poly pShallowCopyDelete_General(poly s_p, ring s_r, ring d_r, omBin d_bin) |
---|
| 18 | { |
---|
| 19 | p_CheckPolyRing(s_p, s_r); |
---|
| 20 | p_CheckRing(d_r); |
---|
| 21 | assume(d_bin != NULL); |
---|
| 22 | assume(d_bin == d_r->PolyBin || d_bin->sizeW == d_r->PolyBin->sizeW); |
---|
| 23 | assume(s_r->N == d_r->N); |
---|
| 24 | |
---|
| 25 | spolyrec dp; |
---|
| 26 | poly d_p = &dp; |
---|
| 27 | int N = d_r->N; |
---|
| 28 | int i; |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | while (s_p != NULL) |
---|
| 32 | { |
---|
| 33 | d_p->next = p_Init(d_r, d_bin); |
---|
| 34 | pIter(d_p); |
---|
| 35 | |
---|
| 36 | pSetCoeff0(d_p, pGetCoeff(s_p)); |
---|
| 37 | for (i=1; i<= N; i++) |
---|
| 38 | p_SetExp(d_p, i, p_GetExp(s_p, i, s_r), d_r); |
---|
| 39 | |
---|
| 40 | if (rRing_has_Comp(d_r)) |
---|
| 41 | p_SetComp(d_p, p_GetComp(s_p, s_r), d_r); |
---|
| 42 | p_Setm(d_p, d_r); |
---|
| 43 | |
---|
| 44 | s_p = p_LmFreeAndNext(s_p, s_r); |
---|
| 45 | } |
---|
| 46 | pNext(d_p) = NULL; |
---|
| 47 | |
---|
| 48 | return dp.next; |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring source_r, ring dest_r) |
---|
| 52 | { |
---|
| 53 | return pShallowCopyDelete_General; |
---|
| 54 | } |
---|