My Project
Loading...
Searching...
No Matches
Typedefs | Functions
prCopy.cc File Reference
#include "misc/auxiliary.h"
#include "polys/monomials/ring.h"
#include "polys/monomials/p_polys.h"
#include "coeffs/numbers.h"
#include "polys/simpleideals.h"
#include "polys/prCopy.inc"

Go to the source code of this file.

Typedefs

typedef poly(* prCopyProc_t) (poly &src_p, ring src_r, ring dest_r)
 

Functions

static void prCopyEvector (poly dest, ring dest_r, poly src, ring src_r, int max)
 
poly prCopyR (poly p, ring src_r, ring dest_r)
 
poly prMapR (poly src, nMapFunc nMap, ring src_r, ring dest_r)
 
poly prCopyR_NoSort (poly p, ring src_r, ring dest_r)
 
poly prMoveR (poly &p, ring src_r, ring dest_r)
 
poly prMoveR_NoSort (poly &p, ring src_r, ring dest_r)
 
poly prShallowCopyR_NoSort (poly p, ring r, ring dest_r)
 
poly prShallowCopyR (poly p, ring r, ring dest_r)
 
poly prHeadR (poly p, ring src_r, ring dest_r, prCopyProc_t prproc)
 
poly prHeadR (poly p, ring src_r, ring dest_r)
 
ideal idrHeadR (ideal id, ring r, ring dest_r)
 Copy leading terms of id[i] via prHeeadR into dest_r. More...
 
static ideal idrCopy (ideal id, ring src_r, ring dest_r, prCopyProc_t prproc)
 
ideal idrCopyR (ideal id, ring src_r, ring dest_r)
 
ideal idrCopyR_NoSort (ideal id, ring src_r, ring dest_r)
 
ideal idrShallowCopyR (ideal id, ring src_r, ring dest_r)
 
ideal idrShallowCopyR_NoSort (ideal id, ring src_r, ring dest_r)
 
static ideal idrMove (ideal &id, ring src_r, ring dest_r, prCopyProc_t prproc)
 
ideal idrMoveR (ideal &id, ring src_r, ring dest_r)
 
ideal idrMoveR_NoSort (ideal &id, ring src_r, ring dest_r)
 

Typedef Documentation

◆ prCopyProc_t

typedef poly(* prCopyProc_t) (poly &src_p, ring src_r, ring dest_r)

Definition at line 124 of file prCopy.cc.

Function Documentation

◆ idrCopy()

static ideal idrCopy ( ideal  id,
ring  src_r,
ring  dest_r,
prCopyProc_t  prproc 
)
inlinestatic

Definition at line 175 of file prCopy.cc.

176{
177 if (id == NULL) return NULL;
178 assume(src_r->cf==dest_r->cf);
179 poly p;
180 ideal res = idInit(IDELEMS(id), id->rank);
181 int i;
182
183 for (i=IDELEMS(id)-1; i>=0; i--)
184 {
185 p = id->m[i];
186 res->m[i] = prproc(p, src_r, dest_r);
187 p_Test(res->m[i], dest_r);
188 }
189 return res;
190}
int i
Definition: cfEzgcd.cc:132
int p
Definition: cfModGcd.cc:4078
CanonicalForm res
Definition: facAbsFact.cc:60
#define assume(x)
Definition: mod2.h:389
#define NULL
Definition: omList.c:12
#define p_Test(p, r)
Definition: p_polys.h:159
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define IDELEMS(i)
Definition: simpleideals.h:23

◆ idrCopyR()

ideal idrCopyR ( ideal  id,
ring  src_r,
ring  dest_r 
)

Definition at line 192 of file prCopy.cc.

193{
194 assume(src_r->cf==dest_r->cf);
195 ideal res;
196 prCopyProc_t prproc;
197 if (rField_has_simple_Alloc(dest_r))
198 prproc = pr_Copy_NoREqual_NSimple_Sort;
199 else
200 prproc = pr_Copy_NoREqual_NoNSimple_Sort;
201 res = idrCopy(id, src_r, dest_r, prproc);
202 return res;
203}
static ideal idrCopy(ideal id, ring src_r, ring dest_r, prCopyProc_t prproc)
Definition: prCopy.cc:175
poly(* prCopyProc_t)(poly &src_p, ring src_r, ring dest_r)
Definition: prCopy.cc:124
static BOOLEAN rField_has_simple_Alloc(const ring r)
Z/p, GF(p,n), R: nCopy, nNew, nDelete are dummies.
Definition: ring.h:552

◆ idrCopyR_NoSort()

ideal idrCopyR_NoSort ( ideal  id,
ring  src_r,
ring  dest_r 
)

Definition at line 205 of file prCopy.cc.

206{
207 assume(src_r->cf==dest_r->cf);
208 ideal res;
209 prCopyProc_t prproc;
210 if (rField_has_simple_Alloc(dest_r))
211 prproc = pr_Copy_NoREqual_NSimple_NoSort;
212 else
213 prproc = pr_Copy_NoREqual_NoNSimple_NoSort;
214 res = idrCopy(id, src_r, dest_r, prproc);
215 return res;
216}

◆ idrHeadR()

ideal idrHeadR ( ideal  id,
ring  r,
ring  dest_r 
)

Copy leading terms of id[i] via prHeeadR into dest_r.

Definition at line 156 of file prCopy.cc.

157{
158 if (id == NULL) return NULL;
159
160 prCopyProc_t prproc = pr_Copy_NoREqual_NoNSimple_NoSort;
161 if (rField_has_simple_Alloc(dest_r))
162 prproc = pr_Copy_NoREqual_NSimple_NoSort;
163
164 const int N = IDELEMS(id);
165 ideal res = idInit(N, id->rank);
166
167 for (int i = N - 1; i >= 0; i--)
168 res->m[i] = prHeadR(id->m[i], r, dest_r, prproc); // !!!
169
170 return res;
171}
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
poly prHeadR(poly p, ring src_r, ring dest_r, prCopyProc_t prproc)
Definition: prCopy.cc:126

◆ idrMove()

static ideal idrMove ( ideal &  id,
ring  src_r,
ring  dest_r,
prCopyProc_t  prproc 
)
inlinestatic

Definition at line 233 of file prCopy.cc.

234{
235 assume(src_r->cf==dest_r->cf);
236 assume( prproc != NULL );
237
238 if (id == NULL) return NULL;
239
240 ideal res = id; id = NULL;
241
242 for (int i = IDELEMS(res) - 1; i >= 0; i--)
243 res->m[i] = prproc(res->m[i], src_r, dest_r);
244
245 return res;
246}

◆ idrMoveR()

ideal idrMoveR ( ideal &  id,
ring  src_r,
ring  dest_r 
)

Definition at line 248 of file prCopy.cc.

249{
250 assume(src_r->cf==dest_r->cf);
251 prCopyProc_t prproc;
252 ideal res;
253 if (rField_has_simple_Alloc(dest_r))
254 prproc = pr_Move_NoREqual_NSimple_Sort;
255 else
256 prproc = pr_Move_NoREqual_NoNSimple_Sort;
257 res = idrMove(id, src_r, dest_r, prproc);
258 return res;
259}
static ideal idrMove(ideal &id, ring src_r, ring dest_r, prCopyProc_t prproc)
Definition: prCopy.cc:233

◆ idrMoveR_NoSort()

ideal idrMoveR_NoSort ( ideal &  id,
ring  src_r,
ring  dest_r 
)

Definition at line 261 of file prCopy.cc.

262{
263 assume(src_r->cf==dest_r->cf);
264 prCopyProc_t prproc;
265 ideal res;
266 if (rField_has_simple_Alloc(dest_r))
267 prproc = pr_Move_NoREqual_NSimple_NoSort;
268 else
269 prproc = pr_Move_NoREqual_NoNSimple_NoSort;
270 res = idrMove(id, src_r, dest_r, prproc);
271 return res;
272}

◆ idrShallowCopyR()

ideal idrShallowCopyR ( ideal  id,
ring  src_r,
ring  dest_r 
)

Definition at line 220 of file prCopy.cc.

221{
222 return idrCopy(id, src_r, dest_r, pr_Copy_NoREqual_NSimple_Sort);
223}

◆ idrShallowCopyR_NoSort()

ideal idrShallowCopyR_NoSort ( ideal  id,
ring  src_r,
ring  dest_r 
)

Definition at line 225 of file prCopy.cc.

226{
227 return idrCopy(id, src_r, dest_r, pr_Copy_NoREqual_NSimple_NoSort);
228}

◆ prCopyEvector()

static void prCopyEvector ( poly  dest,
ring  dest_r,
poly  src,
ring  src_r,
int  max 
)
inlinestatic

Definition at line 18 of file prCopy.cc.

19{
20 //memset(dest->exp,0,dest_r->ExpL_Size*sizeof(long));
21 int i;
22 for (i=max; i>0; i--)
23 {
24 p_SetExp(dest, i, p_GetExp( src, i,src_r), dest_r);
25 }
26 if (rRing_has_Comp(dest_r) && rRing_has_Comp(src_r))
27 p_SetComp(dest, p_GetComp( src,src_r), dest_r);
28 p_Setm(dest, dest_r);
29}
static int max(int a, int b)
Definition: fast_mult.cc:264
#define p_GetComp(p, r)
Definition: monomials.h:64
#define rRing_has_Comp(r)
Definition: monomials.h:266
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:486
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:245
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:231
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:467

◆ prCopyR()

poly prCopyR ( poly  p,
ring  src_r,
ring  dest_r 
)

Definition at line 34 of file prCopy.cc.

35{
36 poly res;
37 if (rField_has_simple_Alloc(dest_r))
38 res = pr_Copy_NoREqual_NSimple_Sort(p, src_r, dest_r);
39 else
40 res = pr_Copy_NoREqual_NoNSimple_Sort(p, src_r, dest_r);
41 p_Test(res, dest_r);
42 return res;
43}

◆ prCopyR_NoSort()

poly prCopyR_NoSort ( poly  p,
ring  src_r,
ring  dest_r 
)

Definition at line 77 of file prCopy.cc.

78{
79 poly res;
80 if (rField_has_simple_Alloc(dest_r))
81 res = pr_Copy_NoREqual_NSimple_NoSort(p, src_r, dest_r);
82 else
83 res = pr_Copy_NoREqual_NoNSimple_NoSort(p, src_r, dest_r);
84 p_Test(res, dest_r);
85 return res;
86}

◆ prHeadR() [1/2]

poly prHeadR ( poly  p,
ring  src_r,
ring  dest_r 
)

Definition at line 141 of file prCopy.cc.

142{
143 prCopyProc_t prproc;
144 if (rField_has_simple_Alloc(dest_r))
145 prproc = pr_Copy_NoREqual_NSimple_NoSort;
146 else
147 prproc = pr_Copy_NoREqual_NoNSimple_NoSort;
148
149 const poly res = prHeadR(p, src_r, dest_r, prproc);
150 p_Test(res, dest_r);
151 return res;
152}

◆ prHeadR() [2/2]

poly prHeadR ( poly  p,
ring  src_r,
ring  dest_r,
prCopyProc_t  prproc 
)

Definition at line 126 of file prCopy.cc.

127{
128 if (p == NULL) return NULL;
129 poly tail, head, q = p;
130 tail = pNext(p);
131 pNext(p) = NULL;
132 head = prproc(q, src_r, dest_r);
133 pNext(p) = tail;
134
135 p_Test(p, src_r);
136 p_Test(head, dest_r);
137
138 return head;
139}
CanonicalForm head(const CanonicalForm &f)
#define pNext(p)
Definition: monomials.h:36

◆ prMapR()

poly prMapR ( poly  src,
nMapFunc  nMap,
ring  src_r,
ring  dest_r 
)

Definition at line 45 of file prCopy.cc.

46{
47 if (src==NULL) return NULL;
48 int _min = si_min(dest_r->N, src_r->N);
49
50 spolyrec dest_s;
51
52 poly dest = &dest_s;
53
54 poly prev;
55 while (src != NULL)
56 {
57 pNext(dest) = (poly) p_Init(dest_r);
58 prev = dest;
59 pIter(dest);
60
61 pSetCoeff0(dest, nMap(pGetCoeff(src),src_r->cf,dest_r->cf));
62 prCopyEvector(dest, dest_r, src, src_r, _min);
63 if (n_IsZero(pGetCoeff(dest),dest_r->cf))
64 {
65 p_LmDelete(&pNext(prev),dest_r);
66 dest=prev;
67 }
68 pIter(src);
69 }
70 pNext(dest) = NULL;
71 dest = pNext(&dest_s);
72 dest=p_SortAdd(dest, dest_r);
73 p_Test(dest, dest_r);
74 return dest;
75}
static int si_min(const int a, const int b)
Definition: auxiliary.h:125
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:461
#define pIter(p)
Definition: monomials.h:37
#define pSetCoeff0(p, n)
Definition: monomials.h:59
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:721
static poly p_Init(const ring r, omBin bin)
Definition: p_polys.h:1318
static poly p_SortAdd(poly p, const ring r, BOOLEAN revert=FALSE)
Definition: p_polys.h:1217
static void prCopyEvector(poly dest, ring dest_r, poly src, ring src_r, int max)
Definition: prCopy.cc:18

◆ prMoveR()

poly prMoveR ( poly &  p,
ring  src_r,
ring  dest_r 
)

Definition at line 90 of file prCopy.cc.

91{
92 poly res;
93 if (rField_has_simple_Alloc(dest_r))
94 res = pr_Move_NoREqual_NSimple_Sort(p, src_r, dest_r);
95 else
96 res = pr_Move_NoREqual_NoNSimple_Sort(p, src_r, dest_r);
97 p_Test(res, dest_r);
98 return res;
99}

◆ prMoveR_NoSort()

poly prMoveR_NoSort ( poly &  p,
ring  src_r,
ring  dest_r 
)

Definition at line 101 of file prCopy.cc.

102{
103 poly res;
104 if (rField_has_simple_Alloc(dest_r))
105 res = pr_Move_NoREqual_NSimple_NoSort(p, src_r, dest_r);
106 else
107 res = pr_Move_NoREqual_NoNSimple_NoSort(p, src_r, dest_r);
108 p_Test(res, dest_r);
109 return res;
110}

◆ prShallowCopyR()

poly prShallowCopyR ( poly  p,
ring  r,
ring  dest_r 
)

Definition at line 117 of file prCopy.cc.

118{
119 return pr_Copy_NoREqual_NSimple_Sort(p, r, dest_r);
120}

◆ prShallowCopyR_NoSort()

poly prShallowCopyR_NoSort ( poly  p,
ring  r,
ring  dest_r 
)

Definition at line 112 of file prCopy.cc.

113{
114 return pr_Copy_NoREqual_NSimple_NoSort(p, r, dest_r);
115}