My Project  UNKNOWN_GIT_VERSION
pShallowCopyDelete.cc
Go to the documentation of this file.
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  *******************************************************************/
10 
11 #include "misc/auxiliary.h"
12 
13 #include "pShallowCopyDelete.h"
14 
15 // a simple implementations
16 poly pShallowCopyDelete_General(poly s_p, ring s_r, ring d_r, omBin d_bin)
17 {
18  p_CheckPolyRing(s_p, s_r);
19  p_CheckRing(d_r);
20  assume(d_bin != NULL);
21  assume(d_bin == d_r->PolyBin || omSizeWOfBin(d_bin) == omSizeWOfBin(d_r->PolyBin));
22  assume(s_r->N == d_r->N);
23 
24  spolyrec dp;
25  poly d_p = &dp;
26  int N = d_r->N;
27  int i;
28 
29 
30  while (s_p != NULL)
31  {
32  d_p->next = p_Init(d_r, d_bin);
33  pIter(d_p);
34 
35  pSetCoeff0(d_p, pGetCoeff(s_p));
36  for (i=1; i<= N; i++)
37  p_SetExp(d_p, i, p_GetExp(s_p, i, s_r), d_r);
38 
39  if (rRing_has_Comp(d_r))
40  p_SetComp(d_p, p_GetComp(s_p, s_r), d_r);
41  p_Setm(d_p, d_r);
42 
43  s_p = p_LmFreeAndNext(s_p, s_r);
44  }
45  pNext(d_p) = NULL;
46 
47  return dp.next;
48 }
49 
50 pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring /*source_r*/, ring /*dest_r*/)
51 {
53 }
p_LmFreeAndNext
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:704
p_GetComp
#define p_GetComp(p, r)
Definition: monomials.h:65
p_GetExp
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:470
auxiliary.h
N
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
spolyrec::next
poly next
Definition: monomials.h:25
p_SetExp
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:489
i
int i
Definition: cfEzgcd.cc:125
pShallowCopyDelete.h
pIter
#define pIter(p)
Definition: monomials.h:38
pShallowCopyDelete_General
poly pShallowCopyDelete_General(poly s_p, ring s_r, ring d_r, omBin d_bin)
Definition: pShallowCopyDelete.cc:16
pGetShallowCopyDeleteProc
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
Definition: pShallowCopyDelete.cc:50
spolyrec
Definition: monomials.h:24
p_Init
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1257
p_CheckRing
BOOLEAN p_CheckRing(ring r)
Definition: pDebug.cc:128
omBin
omBin_t * omBin
Definition: omStructs.h:12
p_CheckPolyRing
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition: pDebug.cc:112
rRing_has_Comp
#define rRing_has_Comp(r)
Definition: monomials.h:267
omSizeWOfBin
#define omSizeWOfBin(bin_ptr)
Definition: omAllocPrivate.h:100
pSetCoeff0
#define pSetCoeff0(p, n)
Definition: monomials.h:60
assume
#define assume(x)
Definition: mod2.h:390
NULL
#define NULL
Definition: omList.c:10
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:248
p_Setm
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
pShallowCopyDeleteProc
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition: ring.h:45
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
pNext
#define pNext(p)
Definition: monomials.h:37