My Project
Loading...
Searching...
No Matches
Functions
pcv.h File Reference

Go to the source code of this file.

Functions

lists pcvLAddL (lists l1, lists l2)
 
lists pcvPMulL (poly p, lists l1)
 
BOOLEAN pcvLAddL (leftv res, leftv h)
 
BOOLEAN pcvPMulL (leftv res, leftv h)
 
int pcvDeg (poly p)
 
int pcvMinDeg (poly p)
 
int pcvMinDeg (matrix m)
 
BOOLEAN pcvMinDeg (leftv res, leftv h)
 
void pcvInit (int d)
 
void pcvClean ()
 
int pcvM2N (poly m)
 
poly pcvN2M (int n)
 
poly pcvP2CV (poly p, int d0, int d1)
 
poly pcvCV2P (poly cv, int d0, int d1)
 
lists pcvP2CV (lists pl, int d0, int d1)
 
ideal pcvP2CV (ideal p, int d0, int d1)
 
lists pcvCV2P (lists cvl, int d0, int d1)
 
ideal pcvCV2P (ideal cv, int d0, int d1)
 
BOOLEAN pcvP2CV (leftv res, leftv h)
 
BOOLEAN pcvCV2P (leftv res, leftv h)
 
int pcvDim (int d0, int d1)
 
BOOLEAN pcvDim (leftv res, leftv h)
 
int pcvBasis (lists b, int i, poly m, int d, int n)
 
lists pcvBasis (int d0, int d1)
 
BOOLEAN pcvBasis (leftv res, leftv h)
 

Function Documentation

◆ pcvBasis() [1/3]

lists pcvBasis ( int  d0,
int  d1 
)

Definition at line 450 of file pcv.cc.

451{
452 if(d0<0) d0=0;
453 if(d1<0) d1=0;
455 b->Init(pcvDim(d0,d1));
456 poly m=pOne();
457 for(int d=d0,i=0;d<d1;d++)
458 i=pcvBasis(b,i,m,d,1);
459 pLmDelete(&m);
460 return b;
461}
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
CanonicalForm b
Definition: cfModGcd.cc:4103
Definition: lists.h:24
VAR omBin slists_bin
Definition: lists.cc:23
slists * lists
Definition: mpr_numeric.h:146
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
int pcvBasis(lists b, int i, poly m, int d, int n)
Definition: pcv.cc:430
int pcvDim(int d0, int d1)
Definition: pcv.cc:400
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pOne()
Definition: polys.h:315

◆ pcvBasis() [2/3]

BOOLEAN pcvBasis ( leftv  res,
leftv  h 
)

Definition at line 463 of file pcv.cc.

464{
465 if(currRing)
466 {
467 const short t[]={2,INT_CMD,INT_CMD};
468 if (iiCheckTypes(h,t,1))
469 {
470 int d0=(int)(long)h->Data();
471 h=h->next;
472 int d1=(int)(long)h->Data();
473 res->rtyp=LIST_CMD;
474 res->data=(void*)pcvBasis(d0,d1);
475 return FALSE;
476 }
477 return TRUE;
478 }
479 WerrorS("no ring active");
480 return TRUE;
481}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
CanonicalForm res
Definition: facAbsFact.cc:60
void WerrorS(const char *s)
Definition: feFopen.cc:24
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6572
STATIC_VAR Poly * h
Definition: janet.cc:971
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
@ LIST_CMD
Definition: tok.h:118
@ INT_CMD
Definition: tok.h:96

◆ pcvBasis() [3/3]

int pcvBasis ( lists  b,
int  i,
poly  m,
int  d,
int  n 
)

Definition at line 430 of file pcv.cc.

431{
432 if(n<currRing->N)
433 {
434 for(int k=0,l=d;k<=l;k++,d--)
435 {
436 pSetExp(m,n,k);
437 i=pcvBasis(b,i,m,d,n+1);
438 }
439 }
440 else
441 {
442 pSetExp(m,n,d);
443 pSetm(m);
444 b->m[i].rtyp=POLY_CMD;
445 b->m[i++].data=pCopy(m);
446 }
447 return i;
448}
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
int l
Definition: cfEzgcd.cc:100
int k
Definition: cfEzgcd.cc:99
@ POLY_CMD
Definition: grammar.cc:289
#define pSetm(p)
Definition: polys.h:271
#define pSetExp(p, i, v)
Definition: polys.h:42
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185

◆ pcvClean()

void pcvClean ( )

Definition at line 223 of file pcv.cc.

224{
225 if(pcvTable)
226 {
229 }
230 if(pcvIndex)
231 {
234 }
235}
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define NULL
Definition: omList.c:12
STATIC_VAR unsigned * pcvTable
Definition: pcv.cc:28
STATIC_VAR unsigned ** pcvIndex
Definition: pcv.cc:29
STATIC_VAR int pcvTableSize
Definition: pcv.cc:26
STATIC_VAR int pcvIndexSize
Definition: pcv.cc:27

◆ pcvCV2P() [1/4]

ideal pcvCV2P ( ideal  cv,
int  d0,
int  d1 
)

◆ pcvCV2P() [2/4]

BOOLEAN pcvCV2P ( leftv  res,
leftv  h 
)

Definition at line 378 of file pcv.cc.

379{
380 if(currRing)
381 {
382 const short t[]={3,LIST_CMD,INT_CMD,INT_CMD};
383 if (iiCheckTypes(h,t,1))
384 {
385 lists pl=(lists)h->Data();
386 h=h->next;
387 int d0=(int)(long)h->Data();
388 h=h->next;
389 int d1=(int)(long)h->Data();
390 res->rtyp=LIST_CMD;
391 res->data=(void*)pcvCV2P(pl,d0,d1);
392 return FALSE;
393 }
394 return TRUE;
395 }
396 WerrorS("no ring active");
397 return TRUE;
398}
poly pcvCV2P(poly cv, int d0, int d1)
Definition: pcv.cc:297

◆ pcvCV2P() [3/4]

lists pcvCV2P ( lists  cvl,
int  d0,
int  d1 
)

Definition at line 339 of file pcv.cc.

340{
342 pl->Init(cvl->nr+1);
343 pcvInit(d1);
344 for(int i=cvl->nr;i>=0;i--)
345 {
346 if(cvl->m[i].rtyp==VECTOR_CMD)
347 {
348 pl->m[i].rtyp=POLY_CMD;
349 pl->m[i].data=pcvCV2P((poly)cvl->m[i].data,d0,d1);
350 }
351 }
352 pcvClean();
353 return pl;
354}
int rtyp
Definition: subexpr.h:91
void * data
Definition: subexpr.h:88
sleftv * m
Definition: lists.h:46
INLINE_THIS void Init(int l=0)
int nr
Definition: lists.h:44
@ VECTOR_CMD
Definition: grammar.cc:292
void pcvInit(int d)
Definition: pcv.cc:193
void pcvClean()
Definition: pcv.cc:223

◆ pcvCV2P() [4/4]

poly pcvCV2P ( poly  cv,
int  d0,
int  d1 
)

Definition at line 297 of file pcv.cc.

298{
299 poly p=NULL;
300 while(cv)
301 {
302 poly m=pcvN2M(pGetComp(cv));
303 if(m)
304 {
305 int d=pcvDeg(m);
306 if(d0<=d&&d<d1)
307 {
309 p=pAdd(p,m);
310 }
311 }
312 pIter(cv);
313 }
314 return p;
315}
int p
Definition: cfModGcd.cc:4078
#define pIter(p)
Definition: monomials.h:37
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
#define nCopy(n)
Definition: numbers.h:15
int pcvDeg(poly p)
Definition: pcv.cc:128
poly pcvN2M(int n)
Definition: pcv.cc:254
#define pAdd(p, q)
Definition: polys.h:203
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31

◆ pcvDeg()

int pcvDeg ( poly  p)

Definition at line 128 of file pcv.cc.

129{
130 int d=0;
131 for(int i=currRing->N;i>=1;i--) d+=pGetExp(p,i);
132 return d;
133}
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41

◆ pcvDim() [1/2]

int pcvDim ( int  d0,
int  d1 
)

Definition at line 400 of file pcv.cc.

401{
402 if(d0<0) d0=0;
403 if(d1<0) d1=0;
404 pcvInit(d1);
405 int d=pcvIndex[currRing->N-1][d1]-pcvIndex[currRing->N-1][d0];
406 pcvClean();
407 return d;
408}

◆ pcvDim() [2/2]

BOOLEAN pcvDim ( leftv  res,
leftv  h 
)

Definition at line 410 of file pcv.cc.

411{
412 if(currRing)
413 {
414 const short t[]={2,INT_CMD,INT_CMD};
415 if (iiCheckTypes(h,t,1))
416 {
417 int d0=(int)(long)h->Data();
418 h=h->next;
419 int d1=(int)(long)h->Data();
420 res->rtyp=INT_CMD;
421 res->data=(void*)(long)pcvDim(d0,d1);
422 return FALSE;
423 }
424 return TRUE;
425 }
426 WerrorS("no ring active");
427 return TRUE;
428}

◆ pcvInit()

void pcvInit ( int  d)

Definition at line 193 of file pcv.cc.

194{
195 if(d<0) d=1;
196 pcvMaxDegree=d+1;
197 pcvTableSize=currRing->N*pcvMaxDegree*sizeof(unsigned);
198 pcvTable=(unsigned*)omAlloc0(pcvTableSize);
199 pcvIndexSize=currRing->N*sizeof(unsigned*);
200 pcvIndex=(unsigned**)omAlloc(pcvIndexSize);
201 for(int i=0;i<currRing->N;i++)
203 for(int i=0;i<pcvMaxDegree;i++)
204 pcvIndex[0][i]=i;
205 unsigned k,l;
206 for(int i=1;i<currRing->N;i++)
207 {
208 k=0;
209 for(int j=0;j<pcvMaxDegree;j++)
210 {
211 l=pcvIndex[i-1][j];
212 if(l>unsigned(~0)-k)
213 {
215 i=currRing->N;
216 WerrorS("unsigned overflow");
217 }
218 else pcvIndex[i][j]=k+=l;
219 }
220 }
221}
int j
Definition: facHensel.cc:110
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omAlloc0(size)
Definition: omAllocDecl.h:211
STATIC_VAR int pcvMaxDegree
Definition: pcv.cc:25

◆ pcvLAddL() [1/2]

BOOLEAN pcvLAddL ( leftv  res,
leftv  h 
)

Definition at line 96 of file pcv.cc.

97{
98 const short t[]={2,LIST_CMD,LIST_CMD};
99 if (iiCheckTypes(h,t,1))
100 {
101 lists l1=(lists)h->Data();
102 h=h->next;
103 lists l2=(lists)h->Data();
104 res->rtyp=LIST_CMD;
105 res->data=(void*)pcvLAddL(l1,l2);
106 return FALSE;
107 }
108 return TRUE;
109}
lists pcvLAddL(lists l1, lists l2)
Definition: pcv.cc:31

◆ pcvLAddL() [2/2]

lists pcvLAddL ( lists  l1,
lists  l2 
)

Definition at line 31 of file pcv.cc.

32{
34 int i=l1->nr;
35 if(l1->nr<l2->nr) i=l2->nr;
36 l0->Init(i+1);
37 for(;i>=0;i--)
38 {
39 if(i<=l1->nr
40 &&(l1->m[i].rtyp==POLY_CMD||l1->m[i].rtyp==BUCKET_CMD||l1->m[i].rtyp==VECTOR_CMD))
41 {
42 if (l1->m[i].rtyp==BUCKET_CMD)
43 {
44 poly p=sBucketPeek((sBucket_pt)l1->m[i].data);
45 l0->m[i].rtyp=POLY_CMD;
46 l0->m[i].data=pCopy(p);
47 }
48 else
49 {
50 l0->m[i].rtyp=l1->m[i].rtyp;
51 l0->m[i].data=pCopy((poly)l1->m[i].data);
52 }
53 if(i<=l2->nr&&l2->m[i].rtyp==l0->m[i].rtyp)
54 l0->m[i].data=pAdd((poly)l0->m[i].data,pCopy((poly)l2->m[i].data));
55 }
56 else
57 if(i<=l2->nr
58 &&(l2->m[i].rtyp==POLY_CMD||l2->m[i].rtyp==BUCKET_CMD||l2->m[i].rtyp==VECTOR_CMD))
59 {
60 if (l2->m[i].rtyp==BUCKET_CMD)
61 {
62 poly p=sBucketPeek((sBucket_pt)l2->m[i].data);
63 l0->m[i].rtyp=POLY_CMD;
64 l0->m[i].data=pCopy(p);
65 }
66 else
67 {
68 l0->m[i].rtyp=l2->m[i].rtyp;
69 l0->m[i].data=pCopy((poly)l2->m[i].data);
70 }
71 }
72 }
73 return(l0);
74}
@ BUCKET_CMD
Definition: grammar.cc:283
poly sBucketPeek(sBucket_pt b)
Definition: sbuckets.cc:455

◆ pcvM2N()

int pcvM2N ( poly  m)

Definition at line 237 of file pcv.cc.

238{
239 unsigned n=0,dn,d=0;
240 for(int i=0;i<currRing->N;i++)
241 {
242 d+=pGetExp(m,i+1);
243 dn=pcvIndex[i][d];
244 if(dn>MAX_INT_VAL-n)
245 {
246 i=currRing->N;
247 WerrorS("component overflow");
248 }
249 else n+=dn;
250 }
251 return n+1;
252}
const int MAX_INT_VAL
Definition: mylimits.h:12

◆ pcvMinDeg() [1/3]

BOOLEAN pcvMinDeg ( leftv  res,
leftv  h 
)

Definition at line 164 of file pcv.cc.

165{
166 if(h)
167 {
168 if(h->Typ()==BUCKET_CMD)
169 {
170 res->rtyp=INT_CMD;
171 res->data=(void*)(long)pcvMinDeg(sBucketPeek((sBucket_pt)h->Data()));
172 return FALSE;
173 }
174 else
175 if(h->Typ()==POLY_CMD)
176 {
177 res->rtyp=INT_CMD;
178 res->data=(void*)(long)pcvMinDeg((poly)h->Data());
179 return FALSE;
180 }
181 else
182 if(h->Typ()==MATRIX_CMD)
183 {
184 res->rtyp=INT_CMD;
185 res->data=(void*)(long)pcvMinDeg((matrix)h->Data());
186 return FALSE;
187 }
188 }
189 WerrorS("<poly> expected");
190 return TRUE;
191}
@ MATRIX_CMD
Definition: grammar.cc:286
int pcvMinDeg(poly p)
Definition: pcv.cc:135

◆ pcvMinDeg() [2/3]

int pcvMinDeg ( matrix  m)

Definition at line 149 of file pcv.cc.

150{
151 int i,j,d;
152 int md=-1;
153 for(i=1;i<=MATROWS(m);i++)
154 {
155 for(j=1;j<=MATCOLS(m);j++)
156 {
157 d=pcvMinDeg(MATELEM(m,i,j));
158 if((d>=0&&md>d)||md==-1) md=d;
159 }
160 }
161 return(md);
162}
#define MATELEM(mat, i, j)
1-based access to matrix
Definition: matpol.h:29
#define MATROWS(i)
Definition: matpol.h:26
#define MATCOLS(i)
Definition: matpol.h:27

◆ pcvMinDeg() [3/3]

int pcvMinDeg ( poly  p)

Definition at line 135 of file pcv.cc.

136{
137 if(!p) return -1;
138 int md=pcvDeg(p);
139 pIter(p);
140 while(p)
141 {
142 int d=pcvDeg(p);
143 if(d<md) md=d;
144 pIter(p);
145 }
146 return md;
147}

◆ pcvN2M()

poly pcvN2M ( int  n)

Definition at line 254 of file pcv.cc.

255{
256 n--;
257 poly m=pOne();
258 int i,j=0,k;
259 for(i=currRing->N-1;i>=0;i--)
260 {
261 k=j;
262 for(j=0; (j<pcvMaxDegree) && (pcvIndex[i][j]<=(unsigned)n); j++);
263 j--;
264 n-=pcvIndex[i][j];
265 if(i<currRing->N-1) pSetExp(m,i+2,k-j);
266 }
267 if(n==0)
268 {
269 pSetExp(m,1,j);
270 pSetm(m);
271 return m;
272 }
273 else
274 {
275 pLmDelete(&m);
276 return NULL;
277 }
278}

◆ pcvP2CV() [1/4]

ideal pcvP2CV ( ideal  p,
int  d0,
int  d1 
)

◆ pcvP2CV() [2/4]

BOOLEAN pcvP2CV ( leftv  res,
leftv  h 
)

Definition at line 356 of file pcv.cc.

357{
358 if(currRing)
359 {
360 const short t[]={3,LIST_CMD,INT_CMD,INT_CMD};
361 if (iiCheckTypes(h,t,1))
362 {
363 lists p=(lists)h->Data();
364 h=h->next;
365 int d0=(int)(long)h->Data();
366 h=h->next;
367 int d1=(int)(long)h->Data();
368 res->rtyp=LIST_CMD;
369 res->data=(void*)pcvP2CV(p,d0,d1);
370 return FALSE;
371 }
372 return TRUE;
373 }
374 WerrorS("no ring active");
375 return TRUE;
376}
poly pcvP2CV(poly p, int d0, int d1)
Definition: pcv.cc:280

◆ pcvP2CV() [3/4]

lists pcvP2CV ( lists  pl,
int  d0,
int  d1 
)

Definition at line 317 of file pcv.cc.

318{
320 cvl->Init(pl->nr+1);
321 pcvInit(d1);
322 for(int i=pl->nr;i>=0;i--)
323 {
324 if(pl->m[i].rtyp==POLY_CMD)
325 {
326 cvl->m[i].rtyp=VECTOR_CMD;
327 cvl->m[i].data=pcvP2CV((poly)pl->m[i].data,d0,d1);
328 }
329 else if(pl->m[i].rtyp==BUCKET_CMD)
330 {
331 cvl->m[i].rtyp=VECTOR_CMD;
332 cvl->m[i].data=pcvP2CV(sBucketPeek((sBucket_pt)pl->m[i].data),d0,d1);
333 }
334 }
335 pcvClean();
336 return cvl;
337}

◆ pcvP2CV() [4/4]

poly pcvP2CV ( poly  p,
int  d0,
int  d1 
)

Definition at line 280 of file pcv.cc.

281{
282 poly cv=NULL;
283 while(p)
284 {
285 int d=pcvDeg(p);
286 if(d0<=d&&d<d1)
287 {
288 poly c=pNSet(nCopy(pGetCoeff(p)));
289 pSetComp(c,pcvM2N(p));
290 cv=pAdd(cv,c);
291 }
292 pIter(p);
293 }
294 return cv;
295}
int pcvM2N(poly m)
Definition: pcv.cc:237
#define pNSet(n)
Definition: polys.h:313
#define pSetComp(p, v)
Definition: polys.h:38

◆ pcvPMulL() [1/2]

BOOLEAN pcvPMulL ( leftv  res,
leftv  h 
)

Definition at line 111 of file pcv.cc.

112{
113 const short t1[]={2,POLY_CMD,LIST_CMD};
114 const short t2[]={2,BUCKET_CMD,LIST_CMD};
115 if (iiCheckTypes(h,t2,0)
116 ||iiCheckTypes(h,t1,1))
117 {
118 poly p=(poly)h->Data();
119 h=h->next;
120 lists l=(lists)h->Data();
121 res->rtyp=LIST_CMD;
122 res->data=(void*)pcvPMulL(p,l);
123 return FALSE;
124 }
125 return TRUE;
126}
lists pcvPMulL(poly p, lists l1)
Definition: pcv.cc:76

◆ pcvPMulL() [2/2]

lists pcvPMulL ( poly  p,
lists  l1 
)

Definition at line 76 of file pcv.cc.

77{
79 l0->Init(l1->nr+1);
80 for(int i=l1->nr;i>=0;i--)
81 {
82 if(l1->m[i].rtyp==POLY_CMD)
83 {
84 l0->m[i].rtyp=POLY_CMD;
85 l0->m[i].data=ppMult_qq(p,(poly)l1->m[i].data);
86 }
87 else if(l1->m[i].rtyp==BUCKET_CMD)
88 {
89 l0->m[i].rtyp=POLY_CMD;
91 }
92 }
93 return(l0);
94}
#define ppMult_qq(p, q)
Definition: polys.h:208