My Project  debian-1:4.1.1-p2+ds-4build1
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 410 of file pcv.cc.

412 {
413  if(d0<0) d0=0;
414  if(d1<0) d1=0;
416  b->Init(pcvDim(d0,d1));
417  poly m=pOne();
418  for(int d=d0,i=0;d<d1;d++)
419  i=pcvBasis(b,i,m,d,1);
420  pLmDelete(&m);
421  return b;

◆ pcvBasis() [2/3]

BOOLEAN pcvBasis ( leftv  res,
leftv  h 
)

Definition at line 423 of file pcv.cc.

425 {
426  if(currRing)
427  {
428  const short t[]={2,INT_CMD,INT_CMD};
429  if (iiCheckTypes(h,t,1))
430  {
431  int d0=(int)(long)h->Data();
432  h=h->next;
433  int d1=(int)(long)h->Data();
434  res->rtyp=LIST_CMD;
435  res->data=(void*)pcvBasis(d0,d1);
436  return FALSE;
437  }
438  return TRUE;
439  }
440  WerrorS("no ring active");
441  return TRUE;

◆ pcvBasis() [3/3]

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

Definition at line 390 of file pcv.cc.

392 {
393  if(n<currRing->N)
394  {
395  for(int k=0,l=d;k<=l;k++,d--)
396  {
397  pSetExp(m,n,k);
398  i=pcvBasis(b,i,m,d,n+1);
399  }
400  }
401  else
402  {
403  pSetExp(m,n,d);
404  pSetm(m);
405  b->m[i].rtyp=POLY_CMD;
406  b->m[i++].data=pCopy(m);
407  }
408  return i;

◆ pcvClean()

void pcvClean ( )

Definition at line 188 of file pcv.cc.

190 {
191  if(pcvTable)
192  {
194  pcvTable=NULL;
195  }
196  if(pcvIndex)
197  {
199  pcvIndex=NULL;
200  }

◆ pcvCV2P() [1/4]

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

◆ pcvCV2P() [2/4]

BOOLEAN pcvCV2P ( leftv  res,
leftv  h 
)

Definition at line 338 of file pcv.cc.

340 {
341  if(currRing)
342  {
343  const short t[]={3,LIST_CMD,INT_CMD,INT_CMD};
344  if (iiCheckTypes(h,t,1))
345  {
346  lists pl=(lists)h->Data();
347  h=h->next;
348  int d0=(int)(long)h->Data();
349  h=h->next;
350  int d1=(int)(long)h->Data();
351  res->rtyp=LIST_CMD;
352  res->data=(void*)pcvCV2P(pl,d0,d1);
353  return FALSE;
354  }
355  return TRUE;
356  }
357  WerrorS("no ring active");
358  return TRUE;

◆ pcvCV2P() [3/4]

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

Definition at line 299 of file pcv.cc.

301 {
303  pl->Init(cvl->nr+1);
304  pcvInit(d1);
305  for(int i=cvl->nr;i>=0;i--)
306  {
307  if(cvl->m[i].rtyp==VECTOR_CMD)
308  {
309  pl->m[i].rtyp=POLY_CMD;
310  pl->m[i].data=pcvCV2P((poly)cvl->m[i].data,d0,d1);
311  }
312  }
313  pcvClean();
314  return pl;

◆ pcvCV2P() [4/4]

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

Definition at line 262 of file pcv.cc.

264 {
265  poly p=NULL;
266  while(cv)
267  {
268  poly m=pcvN2M(pGetComp(cv));
269  if(m)
270  {
271  int d=pcvDeg(m);
272  if(d0<=d&&d<d1)
273  {
274  pSetCoeff(m,nCopy(pGetCoeff(cv)));
275  p=pAdd(p,m);
276  }
277  }
278  pIter(cv);
279  }
280  return p;

◆ pcvDeg()

int pcvDeg ( poly  p)

Definition at line 100 of file pcv.cc.

102 {
103  int d=0;
104  for(int i=currRing->N;i>=1;i--) d+=pGetExp(p,i);
105  return d;

◆ pcvDim() [1/2]

int pcvDim ( int  d0,
int  d1 
)

Definition at line 360 of file pcv.cc.

362 {
363  if(d0<0) d0=0;
364  if(d1<0) d1=0;
365  pcvInit(d1);
366  int d=pcvIndex[currRing->N-1][d1]-pcvIndex[currRing->N-1][d0];
367  pcvClean();
368  return d;

◆ pcvDim() [2/2]

BOOLEAN pcvDim ( leftv  res,
leftv  h 
)

Definition at line 370 of file pcv.cc.

372 {
373  if(currRing)
374  {
375  const short t[]={2,INT_CMD,INT_CMD};
376  if (iiCheckTypes(h,t,1))
377  {
378  int d0=(int)(long)h->Data();
379  h=h->next;
380  int d1=(int)(long)h->Data();
381  res->rtyp=INT_CMD;
382  res->data=(void*)(long)pcvDim(d0,d1);
383  return FALSE;
384  }
385  return TRUE;
386  }
387  WerrorS("no ring active");
388  return TRUE;

◆ pcvInit()

void pcvInit ( int  d)

Definition at line 158 of file pcv.cc.

160 {
161  if(d<0) d=1;
162  pcvMaxDegree=d+1;
163  pcvTableSize=currRing->N*pcvMaxDegree*sizeof(unsigned);
164  pcvTable=(unsigned*)omAlloc0(pcvTableSize);
165  pcvIndexSize=currRing->N*sizeof(unsigned*);
166  pcvIndex=(unsigned**)omAlloc(pcvIndexSize);
167  for(int i=0;i<currRing->N;i++)
169  for(int i=0;i<pcvMaxDegree;i++)
170  pcvIndex[0][i]=i;
171  unsigned k,l;
172  for(int i=1;i<currRing->N;i++)
173  {
174  k=0;
175  for(int j=0;j<pcvMaxDegree;j++)
176  {
177  l=pcvIndex[i-1][j];
178  if(l>unsigned(~0)-k)
179  {
180  j=pcvMaxDegree;
181  i=currRing->N;
182  WerrorS("unsigned overflow");
183  }
184  else pcvIndex[i][j]=k+=l;
185  }
186  }

◆ pcvLAddL() [1/2]

BOOLEAN pcvLAddL ( leftv  res,
leftv  h 
)

Definition at line 70 of file pcv.cc.

72 {
73  const short t[]={2,LIST_CMD,LIST_CMD};
74  if (iiCheckTypes(h,t,1))
75  {
76  lists l1=(lists)h->Data();
77  h=h->next;
78  lists l2=(lists)h->Data();
79  res->rtyp=LIST_CMD;
80  res->data=(void*)pcvLAddL(l1,l2);
81  return FALSE;
82  }
83  return TRUE;

◆ pcvLAddL() [2/2]

lists pcvLAddL ( lists  l1,
lists  l2 
)

Definition at line 30 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&&(l1->m[i].rtyp==POLY_CMD||l1->m[i].rtyp==VECTOR_CMD))
40  {
41  l0->m[i].rtyp=l1->m[i].rtyp;
42  l0->m[i].data=pCopy((poly)l1->m[i].data);
43  if(i<=l2->nr&&l2->m[i].rtyp==l1->m[i].rtyp)
44  l0->m[i].data=pAdd((poly)l0->m[i].data,pCopy((poly)l2->m[i].data));
45  }
46  else
47  if(i<=l2->nr&&(l2->m[i].rtyp==POLY_CMD||l2->m[i].rtyp==VECTOR_CMD))
48  {
49  l0->m[i].rtyp=l2->m[i].rtyp;
50  l0->m[i].data=pCopy((poly)l2->m[i].data);
51  }
52  }
53  return(l0);

◆ pcvM2N()

int pcvM2N ( poly  m)

Definition at line 202 of file pcv.cc.

204 {
205  unsigned n=0,dn,d=0;
206  for(int i=0;i<currRing->N;i++)
207  {
208  d+=pGetExp(m,i+1);
209  dn=pcvIndex[i][d];
210  if(dn>MAX_INT_VAL-n)
211  {
212  i=currRing->N;
213  WerrorS("component overflow");
214  }
215  else n+=dn;
216  }
217  return n+1;

◆ pcvMinDeg() [1/3]

BOOLEAN pcvMinDeg ( leftv  res,
leftv  h 
)

Definition at line 136 of file pcv.cc.

138 {
139  if(h)
140  {
141  if(h->Typ()==POLY_CMD)
142  {
143  res->rtyp=INT_CMD;
144  res->data=(void*)(long)pcvMinDeg((poly)h->Data());
145  return FALSE;
146  }
147  else
148  if(h->Typ()==MATRIX_CMD)
149  {
150  res->rtyp=INT_CMD;
151  res->data=(void*)(long)pcvMinDeg((matrix)h->Data());
152  return FALSE;
153  }
154  }
155  WerrorS("<poly> expected");
156  return TRUE;

◆ pcvMinDeg() [2/3]

int pcvMinDeg ( matrix  m)

Definition at line 121 of file pcv.cc.

123 {
124  int i,j,d;
125  int md=-1;
126  for(i=1;i<=MATROWS(m);i++)
127  {
128  for(j=1;j<=MATCOLS(m);j++)
129  {
130  d=pcvMinDeg(MATELEM(m,i,j));
131  if((d>=0&&md>d)||md==-1) md=d;
132  }
133  }
134  return(md);

◆ pcvMinDeg() [3/3]

int pcvMinDeg ( poly  p)

Definition at line 107 of file pcv.cc.

109 {
110  if(!p) return -1;
111  int md=pcvDeg(p);
112  pIter(p);
113  while(p)
114  {
115  int d=pcvDeg(p);
116  if(d<md) md=d;
117  pIter(p);
118  }
119  return md;

◆ pcvN2M()

poly pcvN2M ( int  n)

Definition at line 219 of file pcv.cc.

221 {
222  n--;
223  poly m=pOne();
224  int i,j=0,k;
225  for(i=currRing->N-1;i>=0;i--)
226  {
227  k=j;
228  for(j=0; (j<pcvMaxDegree) && (pcvIndex[i][j]<=(unsigned)n); j++);
229  j--;
230  n-=pcvIndex[i][j];
231  if(i<currRing->N-1) pSetExp(m,i+2,k-j);
232  }
233  if(n==0)
234  {
235  pSetExp(m,1,j);
236  pSetm(m);
237  return m;
238  }
239  else
240  {
241  pLmDelete(&m);
242  return NULL;
243  }

◆ pcvP2CV() [1/4]

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

◆ pcvP2CV() [2/4]

BOOLEAN pcvP2CV ( leftv  res,
leftv  h 
)

Definition at line 316 of file pcv.cc.

318 {
319  if(currRing)
320  {
321  const short t[]={3,LIST_CMD,INT_CMD,INT_CMD};
322  if (iiCheckTypes(h,t,1))
323  {
324  lists p=(lists)h->Data();
325  h=h->next;
326  int d0=(int)(long)h->Data();
327  h=h->next;
328  int d1=(int)(long)h->Data();
329  res->rtyp=LIST_CMD;
330  res->data=(void*)pcvP2CV(p,d0,d1);
331  return FALSE;
332  }
333  return TRUE;
334  }
335  WerrorS("no ring active");
336  return TRUE;

◆ pcvP2CV() [3/4]

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

Definition at line 282 of file pcv.cc.

284 {
286  cvl->Init(pl->nr+1);
287  pcvInit(d1);
288  for(int i=pl->nr;i>=0;i--)
289  {
290  if(pl->m[i].rtyp==POLY_CMD)
291  {
292  cvl->m[i].rtyp=VECTOR_CMD;
293  cvl->m[i].data=pcvP2CV((poly)pl->m[i].data,d0,d1);
294  }
295  }
296  pcvClean();
297  return cvl;

◆ pcvP2CV() [4/4]

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

Definition at line 245 of file pcv.cc.

247 {
248  poly cv=NULL;
249  while(p)
250  {
251  int d=pcvDeg(p);
252  if(d0<=d&&d<d1)
253  {
254  poly c=pNSet(nCopy(pGetCoeff(p)));
255  pSetComp(c,pcvM2N(p));
256  cv=pAdd(cv,c);
257  }
258  pIter(p);
259  }
260  return cv;

◆ pcvPMulL() [1/2]

BOOLEAN pcvPMulL ( leftv  res,
leftv  h 
)

Definition at line 85 of file pcv.cc.

87 {
88  const short t[]={2,POLY_CMD,LIST_CMD};
89  if (iiCheckTypes(h,t,1))
90  {
91  poly p=(poly)h->Data();
92  h=h->next;
93  lists l=(lists)h->Data();
94  res->rtyp=LIST_CMD;
95  res->data=(void*)pcvPMulL(p,l);
96  return FALSE;
97  }
98  return TRUE;

◆ pcvPMulL() [2/2]

lists pcvPMulL ( poly  p,
lists  l1 
)

Definition at line 55 of file pcv.cc.

57 {
59  l0->Init(l1->nr+1);
60  for(int i=l1->nr;i>=0;i--)
61  {
62  if(l1->m[i].rtyp==POLY_CMD)
63  {
64  l0->m[i].rtyp=POLY_CMD;
65  l0->m[i].data=ppMult_qq(p,(poly)l1->m[i].data);
66  }
67  }
68  return(l0);
FALSE
#define FALSE
Definition: auxiliary.h:94
ip_smatrix
Definition: matpol.h:13
pGetComp
#define pGetComp(p)
Component.
Definition: polys.h:36
j
int j
Definition: facHensel.cc:105
k
int k
Definition: cfEzgcd.cc:92
MATELEM
#define MATELEM(mat, i, j)
Definition: matpol.h:28
pcvTableSize
static int pcvTableSize
Definition: pcv.cc:25
LIST_CMD
Definition: tok.h:117
pGetExp
#define pGetExp(p, i)
Exponent.
Definition: polys.h:40
pcvDeg
int pcvDeg(poly p)
Definition: pcv.cc:100
omAllocBin
#define omAllocBin(bin)
Definition: omAllocDecl.h:203
N
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
pcvBasis
int pcvBasis(lists b, int i, poly m, int d, int n)
Definition: pcv.cc:390
slists::nr
int nr
Definition: lists.h:42
pSetComp
#define pSetComp(p, v)
Definition: polys.h:37
pcvMinDeg
int pcvMinDeg(poly p)
Definition: pcv.cc:107
b
CanonicalForm b
Definition: cfModGcd.cc:4044
slists_bin
omBin slists_bin
Definition: lists.cc:22
ppMult_qq
#define ppMult_qq(p, q)
Definition: polys.h:187
MATRIX_CMD
Definition: grammar.cc:285
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
TRUE
#define TRUE
Definition: auxiliary.h:98
i
int i
Definition: cfEzgcd.cc:125
res
CanonicalForm res
Definition: facAbsFact.cc:64
INT_CMD
Definition: tok.h:95
pcvIndexSize
static int pcvIndexSize
Definition: pcv.cc:26
pcvMaxDegree
static int pcvMaxDegree
Definition: pcv.cc:24
pcvPMulL
lists pcvPMulL(poly p, lists l1)
Definition: pcv.cc:55
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:258
pcvCV2P
poly pcvCV2P(poly cv, int d0, int d1)
Definition: pcv.cc:262
h
static Poly * h
Definition: janet.cc:972
pOne
#define pOne()
Definition: polys.h:289
sleftv::data
void * data
Definition: subexpr.h:87
pcvIndex
static unsigned ** pcvIndex
Definition: pcv.cc:28
pIter
#define pIter(p)
Definition: monomials.h:41
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:208
VECTOR_CMD
Definition: grammar.cc:290
pNSet
#define pNSet(n)
Definition: polys.h:287
slists::m
sleftv * m
Definition: lists.h:44
pAdd
#define pAdd(p, q)
Definition: polys.h:182
pSetCoeff
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:30
slists
Definition: lists.h:21
pcvInit
void pcvInit(int d)
Definition: pcv.cc:158
pcvClean
void pcvClean()
Definition: pcv.cc:188
pcvM2N
int pcvM2N(poly m)
Definition: pcv.cc:202
pcvDim
int pcvDim(int d0, int d1)
Definition: pcv.cc:360
pcvP2CV
poly pcvP2CV(poly p, int d0, int d1)
Definition: pcv.cc:245
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
m
int m
Definition: cfEzgcd.cc:121
MATCOLS
#define MATCOLS(i)
Definition: matpol.h:27
pcvTable
static unsigned * pcvTable
Definition: pcv.cc:27
sleftv::rtyp
int rtyp
Definition: subexpr.h:90
NULL
#define NULL
Definition: omList.c:9
pLmDelete
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:74
lists
slists * lists
Definition: mpr_numeric.h:145
pSetm
#define pSetm(p)
Definition: polys.h:246
pcvLAddL
lists pcvLAddL(lists l1, lists l2)
Definition: pcv.cc:30
l
int l
Definition: cfEzgcd.cc:93
pSetExp
#define pSetExp(p, i, v)
Definition: polys.h:41
slists::Init
INLINE_THIS void Init(int l=0)
p
int p
Definition: cfModGcd.cc:4019
iiCheckTypes
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:6502
POLY_CMD
Definition: grammar.cc:288
pCopy
#define pCopy(p)
return a copy of the poly
Definition: polys.h:165
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:48
MATROWS
#define MATROWS(i)
Definition: matpol.h:26
nCopy
#define nCopy(n)
Definition: numbers.h:15
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:209
pcvN2M
poly pcvN2M(int n)
Definition: pcv.cc:219
MAX_INT_VAL
const int MAX_INT_VAL
Definition: mylimits.h:11