My Project
shiftop.cc
Go to the documentation of this file.
1 #include "shiftop.h"
2 
3 #ifdef HAVE_SHIFTBBA
4 
5 #include "templates/p_MemCopy.h"
6 #include "monomials/p_polys.h"
7 #include "polys/simpleideals.h"
8 
9 /* #define SHIFT_MULT_DEBUG */
10 
11 /*
12  * NEEDED BY
13  * - ncHilb.lib
14  */
15 #define SHIFT_MULT_COMPAT_MODE
16 
17 #ifdef SHIFT_MULT_DEBUG
18 #include "../kernel/polys.h"
19 #endif
20 
21 poly shift_pp_Mult_mm(poly p, const poly m, const ring ri)
22 {
23 #ifdef SHIFT_MULT_DEBUG
24  PrintLn(); PrintS("shift_pp_Mult_mm: ("); p_wrp(p, ri, ri); PrintS(") * "); p_wrp(m, ri, ri);
25 #endif
26 
27  p_Test(p, ri);
28  p_LmTest(m, ri);
29  if (p == NULL)
30  {
31  return NULL;
32  }
33 
34  int lV = ri->isLPring;
35  poly _m = m; // temp hack because m is const
36 #ifdef SHIFT_MULT_COMPAT_MODE
37  _m = p_Copy(_m, ri);
38  p_mLPunshift(_m, ri);
39  p = p_Copy(p, ri);
40  poly pCopyHead = p; // used to delete p later
41  p_LPunshift(p, ri);
42 #else
43  assume(p_mFirstVblock(_m, ri) <= 1);
44  assume(p_FirstVblock(p, ri) <= 1); // TODO check that each block is <=1
45 #endif
46  // at this point _m and p are shifted to 1
47 
48  spolyrec rp;
49  poly q = &rp; // we use p for iterating and q for the result
50  number mCoeff = pGetCoeff(_m);
51  omBin bin = ri->PolyBin;
52  pAssume(!n_IsZero(mCoeff, ri->cf));
53  pAssume1(p_GetComp(m, ri) == 0 || p_MaxComp(p, ri) == 0);
54 
55  int *mExpV = (int *) omAlloc((ri->N+1)*sizeof(int));
56  p_GetExpV(_m,mExpV,ri);
57  int mLength = p_mLastVblock(_m, mExpV, ri) * lV;
58  int *pExpV = (int *) omAlloc((ri->N+1)*sizeof(int));
59  do
60  {
61  p_AllocBin(pNext(q), bin, ri);
62  pIter(q);
63  pNext(q)=NULL;
64  pSetCoeff0(q, n_Mult(mCoeff, pGetCoeff(p), ri->cf));
65 
66  p_GetExpV(p, pExpV, ri);
67  p_LPExpVappend(pExpV, mExpV, p_mLastVblock(p, pExpV, ri) * lV, mLength, ri);
68  p_MemCopy_LengthGeneral(q->exp, p->exp, ri->ExpL_Size); // otherwise q is not initialized correctly
69  p_SetExpV(q, pExpV, ri);
70 
71  pIter(p);
72  }
73  while (p != NULL);
74  omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int));
75  omFreeSize((ADDRESS) mExpV, (ri->N+1)*sizeof(int));
76  pNext(q) = NULL;
77 #ifdef SHIFT_MULT_COMPAT_MODE
78  p_Delete(&_m, ri); // in this case we copied _m before
79  p_Delete(&pCopyHead, ri); // in this case we copied p before
80 #endif
81 #ifdef SHIFT_MULT_DEBUG
82  PrintLn(); PrintS("shift_pp_Mult_mm result: "); p_wrp(pNext(&rp), ri, ri); PrintLn();
83 #endif
84  p_Test(pNext(&rp), ri);
85  return pNext(&rp);
86 }
87 
88 // destroys p
89 poly shift_p_Mult_mm(poly p, const poly m, const ring ri)
90 {
91 #ifdef SHIFT_MULT_DEBUG
92  PrintLn(); PrintS("shift_p_Mult_mm: ("); p_wrp(p, ri, ri); PrintS(") * "); p_wrp(m, ri, ri);
93 #endif
94 
95  p_Test(p, ri);
96  p_LmTest(m, ri);
97  pAssume(m != NULL);
98  assume(p!=NULL);
99 
100  int lV = ri->isLPring;
101  poly _m = m; // temp hack because m is const
102 #ifdef SHIFT_MULT_COMPAT_MODE
103  _m = p_Copy(_m, ri);
104  p_mLPunshift(_m, ri);
105  p_LPunshift(p, ri);
106 #else
107  assume(p_mFirstVblock(_m, ri) <= 1);
108  assume(p_FirstVblock(p, ri) <= 1); // TODO check that each block is <=1
109 #endif
110  // at this point _m and p are shifted to 1
111 
112  poly q = p; // we use p for iterating and q for the result
113  number mCoeff = pGetCoeff(_m);
114  number pCoeff;
115  pAssume(!n_IsZero(mCoeff, ri->cf));
116 
117  int *mExpV = (int *) omAlloc((ri->N+1)*sizeof(int));
118  p_GetExpV(_m,mExpV,ri);
119  int mLength = p_mLastVblock(_m, mExpV, ri) * lV;
120  int *pExpV = (int *) omAlloc((ri->N+1)*sizeof(int));
121  while (p != NULL)
122  {
123  pCoeff = pGetCoeff(p);
124  pSetCoeff0(p, n_Mult(mCoeff, pCoeff, ri->cf));
125  n_Delete(&pCoeff, ri->cf); // delete the old coeff
126 
127  p_GetExpV(p,pExpV,ri);
128  p_LPExpVappend(pExpV, mExpV, p_mLastVblock(p, pExpV, ri) * lV, mLength, ri);
129  p_SetExpV(p, pExpV, ri);
130 
131  pIter(p);
132  }
133  omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int));
134  omFreeSize((ADDRESS) mExpV, (ri->N+1)*sizeof(int));
135 #ifdef SHIFT_MULT_COMPAT_MODE
136  p_Delete(&_m, ri); // in this case we copied _m before
137 #endif
138 #ifdef SHIFT_MULT_DEBUG
139  PrintLn(); PrintS("shift_p_Mult_mm result: "); p_wrp(q, ri, ri); PrintLn();
140 #endif
141  p_Test(q, ri);
142  return q;
143 }
144 
145 poly shift_pp_mm_Mult(poly p, const poly m, const ring ri)
146 {
147 #ifdef SHIFT_MULT_DEBUG
148  PrintLn(); PrintS("shift_pp_mm_Mult: "); p_wrp(m, ri, ri); PrintS(" * ("); p_wrp(p, ri, ri); PrintS(")");
149 #endif
150 
151  p_Test(p, ri);
152  p_LmTest(m, ri);
153  if (p == NULL)
154  {
155  return NULL;
156  }
157 
158  int lV = ri->isLPring;
159  poly _m = m; // temp hack because m is const
160 #ifdef SHIFT_MULT_COMPAT_MODE
161  _m = p_Copy(_m, ri);
162  p_mLPunshift(_m, ri);
163  p = p_Copy(p, ri);
164  poly pCopyHead = p; // used to delete p later
165  p_LPunshift(p, ri);
166 #else
167  assume(p_mFirstVblock(_m, ri) <= 1);
168  assume(p_FirstVblock(p, ri) <= 1); // TODO check that each block is <=1
169 #endif
170  // at this point _m and p are shifted to 1
171 
172  spolyrec rp;
173  poly q = &rp; // we use p for iterating and q for the result
174  number mCoeff = pGetCoeff(_m);
175  omBin bin = ri->PolyBin;
176  pAssume(!n_IsZero(mCoeff, ri->cf));
177  pAssume1(p_GetComp(m, ri) == 0 || p_MaxComp(p, ri) == 0);
178 
179  int *mExpV = (int *) omAlloc((ri->N+1)*sizeof(int));
180  p_GetExpV(_m,mExpV,ri);
181  int mLength = p_mLastVblock(_m, mExpV, ri) * lV;
182  int *pExpV = (int *) omAlloc((ri->N+1)*sizeof(int));
183  do
184  {
185  p_AllocBin(pNext(q), bin, ri);
186  pIter(q);
187  pNext(q)=NULL;
188  pSetCoeff0(q, n_Mult(mCoeff, pGetCoeff(p), ri->cf));
189 
190  p_GetExpV(p, pExpV, ri);
191  p_LPExpVprepend(pExpV, mExpV, p_mLastVblock(p, pExpV, ri) * lV, mLength, ri);
192  p_MemCopy_LengthGeneral(q->exp, p->exp, ri->ExpL_Size); // otherwise q is not initialized correctly
193  p_SetExpV(q, pExpV, ri);
194 
195  pIter(p);
196  }
197  while (p != NULL);
198  omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int));
199  omFreeSize((ADDRESS) mExpV, (ri->N+1)*sizeof(int));
200 #ifdef SHIFT_MULT_COMPAT_MODE
201  p_Delete(&_m, ri); // in this case we copied _m before
202  p_Delete(&pCopyHead, ri); // in this case we copied p before
203 #endif
204 #ifdef SHIFT_MULT_DEBUG
205  PrintLn(); PrintS("shift_pp_mm_Mult result: "); p_wrp(pNext(&rp), ri, ri); PrintLn();
206 #endif
207  p_Test(pNext(&rp), ri);
208  return pNext(&rp);
209 }
210 
211 // destroys p
212 poly shift_p_mm_Mult(poly p, const poly m, const ring ri)
213 {
214 #ifdef SHIFT_MULT_DEBUG
215  PrintLn(); PrintS("shift_p_mm_Mult: "); p_wrp(m, ri, ri); PrintS(" * ("); p_wrp(p, ri, ri); PrintS(")");
216 #endif
217 
218  p_Test(p, ri);
219  p_LmTest(m, ri);
220  pAssume(m != NULL);
221  assume(p!=NULL);
222 
223  int lV = ri->isLPring;
224  poly _m = m; // temp hack because m is const
225 #ifdef SHIFT_MULT_COMPAT_MODE
226  _m = p_Copy(_m, ri);
227  p_mLPunshift(_m, ri);
228  p_LPunshift(p, ri);
229 #else
230  assume(p_mFirstVblock(_m, ri) <= 1);
231  assume(p_FirstVblock(p, ri) <= 1); // TODO check that each block is <=1
232 #endif
233  // at this point _m and p are shifted to 1
234 
235  poly q = p; // we use p for iterating and q for the result
236  number mCoeff = pGetCoeff(_m);
237  number pCoeff;
238  pAssume(!n_IsZero(mCoeff, ri->cf));
239 
240  int *mExpV = (int *) omAlloc((ri->N+1)*sizeof(int));
241  p_GetExpV(_m,mExpV,ri);
242  int mLength = p_mLastVblock(_m, mExpV, ri) * lV;
243  int *pExpV = (int *) omAlloc((ri->N+1)*sizeof(int));
244  while (p != NULL)
245  {
246  pCoeff = pGetCoeff(p);
247  pSetCoeff0(p, n_Mult(mCoeff, pCoeff, ri->cf));
248  n_Delete(&pCoeff, ri->cf); // delete the old coeff
249 
250  p_GetExpV(p,pExpV,ri);
251  p_LPExpVprepend(pExpV, mExpV, p_mLastVblock(p, pExpV, ri) * lV, mLength, ri);
252  p_SetExpV(p, pExpV, ri);
253 
254  pIter(p);
255  }
256  omFreeSize((ADDRESS) pExpV, (ri->N+1)*sizeof(int));
257  omFreeSize((ADDRESS) mExpV, (ri->N+1)*sizeof(int));
258 #ifdef SHIFT_MULT_COMPAT_MODE
259  p_Delete(&_m, ri); // in this case we copied _m before
260 #endif
261 #ifdef SHIFT_MULT_DEBUG
262  PrintLn(); PrintS("shift_p_mm_Mult result: "); p_wrp(q, ri, ri); PrintLn();
263 #endif
264  p_Test(q, ri);
265  return q;
266 }
267 
268 // p - m*q destroys p
269 poly shift_p_Minus_mm_Mult_qq(poly p, poly m, poly q, int& Shorter, const poly spNoether, const ring ri) {
270 #ifdef SHIFT_MULT_DEBUG
271  PrintLn(); PrintS("shift_p_Minus_mm_Mult_qq: "); p_wrp(p, ri, ri); PrintS(" - "); p_wrp(m, ri, ri); PrintS(" * "); p_wrp(q, ri, ri);
272 #endif
273 
274  Shorter = pLength(p) + pLength(q);
275 
276  poly tmp = p_Neg(p_Copy(m, ri), ri);
277  poly qq = p_Add_q(p, shift_pp_mm_Mult(q, tmp, ri), ri);
278  p_Delete(&tmp,ri);
279 
280 #ifdef SHIFT_MULT_DEBUG
281  PrintLn(); PrintS("shift_p_Minus_mm_Mult_qq result: "); p_wrp(qq, ri, ri); PrintLn();
282 #endif
283  Shorter -= pLength(qq);
284  return qq;
285 }
286 
287 // Unsupported Operation STUBs
288 poly shift_pp_Mult_mm_Noether_STUB(poly p, const poly m, const poly spNoether, int &ll, const ring ri) {
289  PrintLn(); WarnS("pp_Mult_mm_Noether is not supported yet by Letterplace. Ignoring spNoether and using pp_Mult_mm. This might lead to unexpected behavior.");
290 
291  int pLen = 0;
292  if (ll >= 0)
293  {
294  pLen = pLength(p);
295  }
296 
297  p = shift_pp_Mult_mm(p, m, ri);
298 
299  if (ll >= 0)
300  {
301  ll = pLen - pLength(p);
302  }
303  else
304  {
305  ll = pLength(p);
306  }
307 
308  return p;
309 }
310 
311 
312 poly shift_pp_Mult_Coeff_mm_DivSelectMult_STUB(poly p,const poly m, const poly a, const poly b, int &shorter,const ring r) {
313  PrintLn(); WarnS("pp_Mult_Coeff_mm_DivSelectMult is not supported yet by Letterplace. This might lead to unexpected behavior.");
314  return NULL;
315 }
316 
317 poly shift_pp_Mult_Coeff_mm_DivSelect_STUB(poly p, const poly m, int &shorter, const ring r) {
318  PrintLn(); WarnS("pp_Mult_Coeff_mm_DivSelect is not supported yet by Letterplace. This might lead to unexpected behavior.");
319  return NULL;
320 }
321 
322 // auxiliary
323 
324 // unshifts the monomial m
325 void p_mLPunshift(poly m, const ring ri)
326 {
327  if (m == NULL || p_LmIsConstantComp(m,ri)) return;
328 
329  int lV = ri->isLPring;
330 
331  int shift = p_mFirstVblock(m, ri) - 1;
332 
333  if (shift == 0) return;
334 
335  int *e=(int *)omAlloc((ri->N+1)*sizeof(int));
336  int *s=(int *)omAlloc0((ri->N+1)*sizeof(int));
337  p_GetExpV(m, e, ri);
338 
339  int expVoffset = shift*lV;
340  for (int i = 1 + expVoffset; i <= ri->N; i++)
341  {
342  assume(e[i] <= 1);
343  s[i - expVoffset] = e[i];
344  }
345  p_SetExpV(m,s,ri);
346  omFreeSize((ADDRESS) e, (ri->N+1)*sizeof(int));
347  omFreeSize((ADDRESS) s, (ri->N+1)*sizeof(int));
348 }
349 
350 // unshifts the polynomial p, note: the ordering can be destroyed if the shifts for the monomials are not equal
351 void p_LPunshift(poly p, const ring ri)
352 {
353  while (p!=NULL)
354  {
355  p_mLPunshift(p, ri);
356  pIter(p);
357  }
358 }
359 
360 void p_mLPshift(poly m, int sh, const ring ri)
361 {
362  if (sh == 0 || m == NULL || p_LmIsConstantComp(m,ri)) return;
363 
364  int lV = ri->isLPring;
365 
366  assume(p_mFirstVblock(m,ri) + sh >= 1);
367  assume(p_mLastVblock(m,ri) + sh <= ri->N/lV);
368 
369  int *e=(int *)omAlloc((ri->N+1)*sizeof(int));
370  int *s=(int *)omAlloc0((ri->N+1)*sizeof(int));
371  p_GetExpV(m,e,ri);
372 
373  if (p_mLastVblock(m, e, ri) + sh > ri->N/lV)
374  {
375  Werror("degree bound of Letterplace ring is %d, but at least %d is needed for this shift", ri->N/lV, p_mLastVblock(m, e, ri) + sh);
376  }
377  for (int i = ri->N - sh*lV; i > 0; i--)
378  {
379  assume(e[i]<=1);
380  if (e[i]==1)
381  {
382  s[i + (sh*lV)] = e[i]; /* actually 1 */
383  }
384  }
385  p_SetExpV(m,s,ri);
386  omFreeSize((ADDRESS) e, (ri->N+1)*sizeof(int));
387  omFreeSize((ADDRESS) s, (ri->N+1)*sizeof(int));
388 }
389 
390 void p_LPshift(poly p, int sh, const ring ri)
391 {
392  if (sh == 0) return;
393 
394  while (p!=NULL)
395  {
396  p_mLPshift(p, sh, ri);
397  pIter(p);
398  }
399 }
400 
401 /* returns the number of maximal block */
402 /* appearing among the monomials of p */
403 /* the 0th block is the 1st one */
404 int p_LastVblock(poly p, const ring r)
405 {
406  poly q = p;
407  int ans = 0;
408  while (q!=NULL)
409  {
410  int ansnew = p_mLastVblock(q, r);
411  ans = si_max(ans,ansnew);
412  pIter(q);
413  }
414  return(ans);
415 }
416 
417 /* for a monomial p, returns the number of the last block */
418 /* where a nonzero exponent is sitting */
419 int p_mLastVblock(poly p, const ring ri)
420 {
421  if (p == NULL || p_LmIsConstantComp(p,ri))
422  {
423  return(0);
424  }
425 
426  int *e=(int *)omAlloc((ri->N+1)*sizeof(int));
427  p_GetExpV(p,e,ri);
428  int b = p_mLastVblock(p, e, ri);
429  omFreeSize((ADDRESS) e, (ri->N+1)*sizeof(int));
430  return b;
431 }
432 
433 /* for a monomial p with exponent vector expV, returns the number of the last block */
434 /* where a nonzero exponent is sitting */
435 int p_mLastVblock(poly p, int *expV, const ring ri)
436 {
437  if (p == NULL || p_LmIsConstantComp(p,ri))
438  {
439  return(0);
440  }
441 
442  int lV = ri->isLPring;
443  int j,b;
444  j = ri->N;
445  while ( (!expV[j]) && (j>=1) ) j--;
446  assume(j>0);
447  b = (int)((j+lV-1)/lV); /* the number of the block, >=1 */
448  return b;
449 }
450 
451 /* returns the number of maximal block */
452 /* appearing among the monomials of p */
453 /* the 0th block is the 1st one */
454 int p_FirstVblock(poly p, const ring r)
455 {
456  if (p == NULL) {
457  return 0;
458  }
459 
460  poly q = p;
461  int ans = p_mFirstVblock(q, r);
462  while (q!=NULL)
463  {
464  int ansnew = p_mFirstVblock(q, r);
465  if (ansnew > 0) { // don't count constants
466  ans = si_min(ans,ansnew);
467  }
468  pIter(q);
469  }
470  /* do not need to delete q */
471  return(ans);
472 }
473 
474 /* for a monomial p, returns the number of the first block */
475 /* where a nonzero exponent is sitting */
476 int p_mFirstVblock(poly p, const ring ri)
477 {
478  if (p == NULL || p_LmIsConstantComp(p,ri))
479  {
480  return(0);
481  }
482 
483  int *e=(int *)omAlloc((ri->N+1)*sizeof(int));
484  p_GetExpV(p,e,ri);
485  int b = p_mFirstVblock(p, e, ri);
486  omFreeSize((ADDRESS) e, (ri->N+1)*sizeof(int));
487  return b;
488 }
489 
490 /* for a monomial p with exponent vector expV, returns the number of the first block */
491 /* where a nonzero exponent is sitting */
492 int p_mFirstVblock(poly p, int *expV, const ring ri)
493 {
494  if (p == NULL || p_LmIsConstantComp(p,ri))
495  {
496  return(0);
497  }
498 
499  int lV = ri->isLPring;
500  int j,b;
501  j = 1;
502  while ( (!expV[j]) && (j<=ri->N-1) ) j++;
503  assume(j <= ri->N);
504  b = (int)(j+lV-1)/lV; /* the number of the block, 1<= b <= r->N */
505  return b;
506 }
507 
508 // appends m2ExpV to m1ExpV, also adds their components (one of them is always zero)
509 void p_LPExpVappend(int *m1ExpV, int *m2ExpV, int m1Length, int m2Length, const ring ri) {
510 #ifdef SHIFT_MULT_DEBUG
511  PrintLn(); PrintS("Append");
512  PrintLn(); WriteLPExpV(m1ExpV, ri);
513  PrintLn(); WriteLPExpV(m2ExpV, ri);
514 #endif
515  int last = m1Length + m2Length;
516  if (last > ri->N)
517  {
518  Werror("degree bound of Letterplace ring is %d, but at least %d is needed for this multiplication", ri->N/ri->isLPring, last/ri->isLPring);
519  last = ri->N;
520  }
521  for (int i = 1 + m1Length; i < 1 + last; ++i)
522  {
523  assume(m2ExpV[i - m1Length] <= 1);
524  m1ExpV[i] = m2ExpV[i - m1Length];
525  }
526 
527  assume(m1ExpV[0] == 0 || m2ExpV[0] == 0); // one component should be zero (otherwise this doesn't make any sense)
528  m1ExpV[0] += m2ExpV[0]; // as in the commutative variant (they use MemAdd)
529 #ifdef SHIFT_MULT_DEBUG
530  PrintLn(); WriteLPExpV(m1ExpV, ri);
531 #endif
532  assume(_p_mLPNCGenValid(m1ExpV, ri));
533 }
534 
535 // prepends m2ExpV to m1ExpV, also adds their components (one of them is always zero)
536 void p_LPExpVprepend(int *m1ExpV, int *m2ExpV, int m1Length, int m2Length, const ring ri)
537 {
538 #ifdef SHIFT_MULT_DEBUG
539  PrintLn(); PrintS("Prepend");
540  PrintLn(); WriteLPExpV(m1ExpV, ri);
541  PrintLn(); WriteLPExpV(m2ExpV, ri);
542 #endif
543  int last = m1Length + m2Length;
544  if (last > ri->N)
545  {
546  Werror("degree bound of Letterplace ring is %d, but at least %d is needed for this multiplication", ri->N/ri->isLPring, last/ri->isLPring);
547  last = ri->N;
548  }
549 
550  // shift m1 by m2Length
551  for (int i = last; i >= 1 + m2Length; --i)
552  {
553  m1ExpV[i] = m1ExpV[i - m2Length];
554  }
555 
556  // write m2 to m1
557  for (int i = 1; i < 1 + m2Length; ++i)
558  {
559  assume(m2ExpV[i] <= 1);
560  m1ExpV[i] = m2ExpV[i];
561  }
562 
563  assume(m1ExpV[0] == 0 || m2ExpV[0] == 0); // one component should be zero (otherwise this doesn't make any sense)
564  m1ExpV[0] += m2ExpV[0]; // as in the commutative variant (they use MemAdd)
565 #ifdef SHIFT_MULT_DEBUG
566  PrintLn(); WriteLPExpV(m1ExpV, ri);
567 #endif
568  assume(_p_mLPNCGenValid(m1ExpV, ri));
569 }
570 
571 void WriteLPExpV(int *expV, ring ri)
572 {
573  char *s = LPExpVString(expV, ri);
574  PrintS(s);
575  omFree(s);
576 }
577 
578 char* LPExpVString(int *expV, ring ri)
579 {
580  StringSetS("");
581  for (int i = 0; i <= ri->N; ++i)
582  {
583  StringAppend("%d", expV[i]);
584  if (i == 0)
585  {
586  StringAppendS("| ");
587  }
588  if (i % ri->isLPring == 0 && i != ri->N)
589  {
590  StringAppendS(" ");
591  }
592  }
593  return StringEndS();
594 }
595 
596 // splits a frame (e.g. x(1)*y(5)) m1 into m1 and m2 (e.g. m1=x(1) and m2=y(1))
597 // at is the number of the block to split at, starting at 1
598 void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
599 {
600  assume(at >= 1);
601  assume(at <= r->N/r->isLPring);
602  int lV = r->isLPring;
603  int split = (lV * (at - 1));
604 
605  m2 = p_GetExp_k_n(m1, 1, split, r);
606  p_SetComp(m2, 0, r); // important, otherwise both m1 and m2 have a component set, this leads to problems later
607  p_Setm(m2, r); // p_mLPunshift also implicitly calls p_Setm(), but just for the case this changes in future.
608  p_mLPunshift(m2, r);
609 
610  m1 = p_Head0(m1, r);
611  for(int i = split + 1; i <= r->N; i++)
612  {
613  p_SetExp(m1, i, 0, r);
614  }
615  p_Setm(m1, r);
616 
617  assume(p_FirstVblock(m1,r) <= 1);
618  assume(p_FirstVblock(m2,r) <= 1);
619 }
620 
621 BOOLEAN _p_mLPNCGenValid(poly p, const ring r)
622 {
623  if (p == NULL) return TRUE;
624  int *e=(int *)omAlloc((r->N+1)*sizeof(int));
625  p_GetExpV(p,e,r);
626  int b = _p_mLPNCGenValid(e, r);
627  omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int));
628  return b;
629 }
630 
631 BOOLEAN _p_mLPNCGenValid(int *mExpV, const ring r)
632 {
633  BOOLEAN hasNCGen = FALSE;
634  int lV = r->isLPring;
635  int degbound = r->N/lV;
636  int ncGenCount = r->LPncGenCount;
637  for (int i = 1; i <= degbound; i++)
638  {
639  for (int j = i*lV; j > (i*lV - ncGenCount); j--)
640  {
641  if (mExpV[j])
642  {
643  if (hasNCGen)
644  {
645  return FALSE;
646  }
647  hasNCGen = TRUE;
648  }
649  }
650  }
651  return TRUE;
652 }
653 
654 int p_GetNCGen(poly p, const ring r)
655 {
656  if (p == NULL) return 0;
658 
659  int lV = r->isLPring;
660  int degbound = r->N/lV;
661  int ncGenCount = r->LPncGenCount;
662  for (int i = 1; i <= degbound; i++)
663  {
664  for (int j = i*lV; j > (i*lV - ncGenCount); j--)
665  {
666  if (p_GetExp(p, j, r))
667  {
668  return j - i*lV + ncGenCount;
669  }
670  }
671  }
672  return 0;
673 }
674 
675 /* tests whether each polynomial of an ideal I lies in in V */
676 int id_IsInV(ideal I, const ring r)
677 {
678  int i;
679  int s = IDELEMS(I)-1;
680  for(i = 0; i <= s; i++)
681  {
682  if ( !p_IsInV(I->m[i], r) )
683  {
684  return(0);
685  }
686  }
687  return(1);
688 }
689 
690 /* tests whether the whole polynomial p in in V */
691 int p_IsInV(poly p, const ring r)
692 {
693  poly q = p;
694  while (q!=NULL)
695  {
696  if ( !p_mIsInV(q, r) )
697  {
698  return(0);
699  }
700  q = pNext(q);
701  }
702  return(1);
703 }
704 
705 /* there should be two routines: */
706 /* 1. test place-squarefreeness: in homog this suffices: isInV */
707 /* 2. test the presence of a hole -> in the tail??? */
708 
709 int p_mIsInV(poly p, const ring r)
710 {
711  int lV = r->isLPring;
712  /* investigate only the leading monomial of p in currRing */
713  if ( p_Totaldegree(p, r)==0 ) return(1);
714  /* returns 1 iff p is in V */
715  /* that is in each block up to a certain one there is only one nonzero exponent */
716  /* lV = the length of V = the number of orig vars */
717  int *e = (int *)omAlloc((r->N+1)*sizeof(int));
718  int b = (int)((r->N+lV-1)/lV); /* the number of blocks */
719  //int b = (int)(currRing->N)/lV;
720  int *B = (int *)omAlloc0((b+1)*sizeof(int)); /* the num of elements in a block */
721  p_GetExpV(p,e,r);
722  int i,j;
723  for (j=1; j<=b; j++)
724  {
725  /* we go through all the vars */
726  /* by blocks in lV vars */
727  for (i=(j-1)*lV + 1; i<= j*lV; i++)
728  {
729  if (e[i]) B[j] = B[j]+1;
730  }
731  }
732  // j = b;
733  // while ( (!B[j]) && (j>=1)) j--;
734  for (j=b; j>=1; j--)
735  {
736  if (B[j]!=0) break;
737  }
738 
739  if (j==0)
740  {
741  omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int));
742  omFreeSize((ADDRESS) B, (b+1)*sizeof(int));
743  return 1;
744  }
745 
746  if (!_p_mLPNCGenValid(e, r))
747  {
748  omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int));
749  omFreeSize((ADDRESS) B, (b+1)*sizeof(int));
750  return 0;
751  }
752 
753  omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int));
754 
755 // {
756 // /* it is a zero exp vector, which is in V */
757 // freeT(B, b);
758 // return(1);
759 // }
760  /* now B[j] != 0 and we test place-squarefreeness */
761  for (; j>=1; j--)
762  {
763  if (B[j]!=1)
764  {
765  omFreeSize((ADDRESS) B, (b+1)*sizeof(int));
766  return 0;
767  }
768  }
769 
770  omFreeSize((ADDRESS) B, (b+1)*sizeof(int));
771  return 1;
772 }
773 
774 BOOLEAN p_LPDivisibleBy(poly a, poly b, const ring r)
775 {
777  pIfThen1(a!=NULL, p_LmCheckPolyRing1(a, r));
778 
779  if (b == NULL) return TRUE;
780  if (a != NULL && (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r)))
781  return _p_LPLmDivisibleByNoComp(a,b,r);
782  return FALSE;
783 }
784 
785 BOOLEAN p_LPLmDivisibleBy(poly a, poly b, const ring r)
786 {
787  p_LmCheckPolyRing1(b, r);
788  pIfThen1(a != NULL, p_LmCheckPolyRing1(b, r));
789  if (p_GetComp(a, r) == 0 || p_GetComp(a,r) == p_GetComp(b,r))
790  return _p_LPLmDivisibleByNoComp(a, b, r);
791  return FALSE;
792 }
793 
794 BOOLEAN _p_LPLmDivisibleByNoComp(poly a, poly b, const ring r)
795 {
796 #ifdef SHIFT_MULT_COMPAT_MODE
797  a = p_Head0(a, r);
798  p_mLPunshift(a, r);
799  b = p_Head0(b, r);
800  p_mLPunshift(b, r);
801 #endif
802  int aLastVblock = p_mLastVblock(a, r);
803  int bLastVblock = p_mLastVblock(b, r);
804  for (int i = 0; i <= bLastVblock - aLastVblock; i++)
805  {
806  bool divisible = true;
807  for (int j = 1; j <= aLastVblock * r->isLPring; j++)
808  {
809  if (p_GetExp(a, j, r) > p_GetExp(b, j + (i * r->isLPring), r))
810  {
811  divisible = false;
812  break;
813  }
814  }
815  if (divisible)
816  {
817  #ifdef SHIFT_MULT_COMPAT_MODE
818  p_LmDelete0(a, r);
819  p_LmDelete0(b, r);
820  #endif
821  return TRUE;
822  }
823  }
824 #ifdef SHIFT_MULT_COMPAT_MODE
825  p_LmDelete0(a, r);
826  p_LmDelete0(b, r);
827 #endif
828  return FALSE;
829 }
830 
831 BOOLEAN p_LPDivisibleBy(ideal I, poly p, ring r)
832 {
833  for(int i = 0; i < IDELEMS(I); i++)
834  {
835  if (p_LPDivisibleBy(I->m[i], p, r))
836  {
837  return TRUE;
838  }
839  }
840  return FALSE;
841 }
842 
843 poly p_LPVarAt(poly p, int pos, const ring r)
844 {
845  if (p == NULL || pos < 1 || pos > (r->N / r->isLPring)) return NULL;
846  poly v = p_One(r);
847  for (int i = (pos-1) * r->isLPring + 1; i <= pos * r->isLPring; i++) {
848  if (p_GetExp(p, i, r)) {
849  p_SetExp(v, i - (pos-1) * r->isLPring, 1, r);
850  return v;
851  }
852  }
853  return v;
854 }
855 
856 
857 /*
858 * substitute the n-th variable by e in m
859 * does not destroy m
860 */
861 poly p_mLPSubst(poly m, int n, poly e, const ring r)
862 {
863  assume(p_GetComp(e, r) == 0);
864  if (m == NULL) return NULL;
865 
866  int lV = r->isLPring;
867  int degbound = r->N/lV;
868 
869  poly result = p_One(r);
870  poly remaining = p_Head(m, r);
871  p_SetComp(result, p_GetComp(remaining, r), r);
872  p_SetComp(remaining, 0, r);
873  for (int i = 0; i < degbound; i++)
874  {
875  int var = n + lV*i;
876  if (p_GetExp(remaining, var, r)) {
877  if (e == NULL) {
878  p_Delete(&result, r);
879  result = NULL;
880  break;
881  }
882  int startOfBlock = 1 + lV*i;
883  int endOfBlock = lV*(i+1);
884 
885  poly left = p_GetExp_k_n(remaining, startOfBlock, r->N, r);
886  p_SetCoeff(left, n_Copy(p_GetCoeff(remaining, r), r->cf), r);
887  p_mLPunshift(left, r);
888 
889  poly right = p_GetExp_k_n(remaining, 1, endOfBlock, r);
890  p_Delete(&remaining, r);
891  remaining = right;
892 
893  left = p_Mult_q(left, p_Copy(e, r), r);
894  result = p_Mult_q(result, left, r);
895  }
896  }
897  if (result == NULL) {
898  return NULL;
899  } else {
900  p_mLPunshift(remaining, r);
901  return p_Mult_q(result, remaining, r);
902  }
903 }
904 
905 /*
906 * also see p_Subst()
907 * substitute the n-th variable by e in p
908 * does not destroy p
909 */
910 poly p_LPSubst(poly p, int n, poly e, const ring r)
911 {
912  poly res = NULL;
913  while (p!=NULL)
914  {
915  res = p_Add_q(res, p_mLPSubst(p, n, e, r), r);
916  pIter(p);
917  }
918  return res;
919 }
920 
921 /// substitute weights from orderings a,wp,Wp
922 /// by d copies of it at position p
923 static BOOLEAN freeAlgebra_weights(const ring old_ring, ring new_ring, int p, int d)
924 {
925  omFree(new_ring->wvhdl[p]);
926  int *w=(int*)omAlloc(new_ring->N*sizeof(int));
927  for(int b=0;b<d;b++)
928  {
929  for(int i=old_ring->N-1;i>=0;i--)
930  {
931  if (old_ring->wvhdl[p][i]<-0) return TRUE;
932  w[b*old_ring->N+i]=old_ring->wvhdl[p][i];
933  }
934  }
935  new_ring->wvhdl[p]=w;
936  new_ring->block1[p]=new_ring->N;
937  return FALSE;
938 }
939 
940 ring freeAlgebra(ring r, int d, int ncGenCount)
941 {
942  if (ncGenCount) r = rCopy0(r);
943  char *varname=(char *)omAlloc(20);
944  for (int i = 1; i <= ncGenCount; i++)
945  {
946  sprintf(varname, "ncgen(%d)", i);
947  ring save = r;
948  r = rPlusVar(r, varname, 0);
949  if (r==NULL)
950  {
951  omFreeSize(varname, 20);
952  return NULL; /* error in rPlusVar*/
953  }
954  rDelete(save);
955  }
956  omFreeSize(varname, 20);
957  ring R=rCopy0(r);
958  int p;
959  if((r->order[0]==ringorder_C)
960  ||(r->order[0]==ringorder_c))
961  p=1;
962  else
963  p=0;
964  // create R->N
965  R->N=r->N*d;
966  if (ncGenCount>0)
967  R->wanted_maxExp=7; /* Tst/Manual/letterplace_liftstd.tst*/
968  else
969  R->wanted_maxExp=3;
970  R->isLPring=r->N;
971  R->LPncGenCount=ncGenCount;
972  // create R->order
973  BOOLEAN has_order_a=FALSE;
974  while (r->order[p]==ringorder_a)
975  {
976  if (freeAlgebra_weights(r,R,p,d))
977  {
978  WerrorS("weights must be positive");
979  return NULL;
980  }
981  has_order_a=TRUE;
982  p++;
983  }
984  R->block1[p]=R->N; /* only dp,Dp,wp,Wp; will be discarded for lp*/
985  switch(r->order[p])
986  {
987  case ringorder_dp:
988  case ringorder_Dp:
989  break;
990  case ringorder_wp:
991  case ringorder_Wp:
992  if (freeAlgebra_weights(r,R,p,d))
993  {
994  WerrorS("weights must be positive");
995  return NULL;
996  }
997  break;
998  case ringorder_lp:
999  case ringorder_rp:
1000  {
1001  if(has_order_a)
1002  {
1003  WerrorS("ordering (a(..),lp/rp not implemented for Letterplace rings");
1004  return NULL;
1005  }
1006  int ** wvhdl=(int**)omAlloc0((r->N+3)*sizeof(int*));
1007  rRingOrder_t* ord=(rRingOrder_t*)omAlloc0((r->N+3)*sizeof(rRingOrder_t));
1008  int* blk0=(int*)omAlloc0((r->N+3)*sizeof(int));
1009  int* blk1=(int*)omAlloc0((r->N+3)*sizeof(int));
1010  omFree(R->wvhdl); R->wvhdl=wvhdl;
1011  omFree(R->order); R->order=ord;
1012  omFree(R->block0); R->block0=blk0;
1013  omFree(R->block1); R->block1=blk1;
1014  for(int i=0;i<r->N;i++)
1015  {
1016  ord[i+p]=ringorder_a;
1017  //Print("entry:%d->a\n",i+p);
1018  blk0[i+p]=1;
1019  blk1[i+p]=R->N;
1020  wvhdl[i+p]=(int*)omAlloc0(R->N*sizeof(int));
1021  for(int j=0;j<d;j++)
1022  {
1023  assume(j*r->N+i<R->N);
1024  if (r->order[p]==ringorder_lp)
1025  wvhdl[i+p][j*r->N+i]=1;
1026  else
1027  wvhdl[i+p][(j+1)*r->N-i-1]=1;
1028  }
1029  }
1030  ord[r->N+p]=r->order[p]; /* lp or rp */
1031  //Print("entry:%d->lp\n",r->N+p);
1032  blk0[r->N+p]=1;
1033  blk1[r->N+p]=R->N;
1034  // copy component order
1035  if (p==1) ord[0]=r->order[0];
1036  else if (p==0) ord[r->N+1]=r->order[1];
1037  else
1038  { // should never happen:
1039  WerrorS("ordering not implemented for Letterplace rings");
1040  return NULL;
1041  }
1042  //if (p==1) PrintS("entry:0 ->c/C\n");
1043  //else if (p==0) Print("entry:%d ->c/C\n",r->N+1);
1044  break;
1045  }
1046  default: WerrorS("ordering not implemented for Letterplace rings");
1047  return NULL;
1048  }
1049  // create R->names
1050  char **names=(char**)omAlloc(R->N*sizeof(char*));
1051  for(int b=0;b<d;b++)
1052  {
1053  for(int i=r->N-1;i>=0;i--)
1054  names[b*r->N+i]=omStrDup(r->names[i]);
1055  }
1056  for(int i=r->N-1;i>=0;i--) omFree(R->names[i]);
1057  omFree(R->names);
1058  R->names=names;
1059 
1060  if (ncGenCount) rDelete(r);
1061  rComplete(R,TRUE);
1062  return R;
1063 }
1064 #endif
static int si_max(const int a, const int b)
Definition: auxiliary.h:124
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
void * ADDRESS
Definition: auxiliary.h:119
static int si_min(const int a, const int b)
Definition: auxiliary.h:125
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
int p
Definition: cfModGcd.cc:4078
CanonicalForm b
Definition: cfModGcd.cc:4103
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
#define WarnS
Definition: emacs.cc:78
#define StringAppend
Definition: emacs.cc:79
return result
Definition: facAbsBiFact.cc:75
const CanonicalForm int s
Definition: facAbsFact.cc:51
CanonicalForm res
Definition: facAbsFact.cc:60
const CanonicalForm & w
Definition: facAbsFact.cc:51
b *CanonicalForm B
Definition: facBivar.cc:52
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
int j
Definition: facHensel.cc:110
static CFList split(const CanonicalForm &F, const int m, const Variable &x)
Definition: facMul.cc:3469
void WerrorS(const char *s)
Definition: feFopen.cc:24
STATIC_VAR poly last
Definition: hdegree.cc:1151
#define assume(x)
Definition: mod2.h:387
#define p_GetComp(p, r)
Definition: monomials.h:64
#define pIfThen1(cond, check)
Definition: monomials.h:179
#define pIter(p)
Definition: monomials.h:37
#define pNext(p)
Definition: monomials.h:36
#define p_LmCheckPolyRing1(p, r)
Definition: monomials.h:177
#define pAssume1(cond)
Definition: monomials.h:171
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 pSetCoeff0(p, n)
Definition: monomials.h:59
#define p_GetCoeff(p, r)
Definition: monomials.h:50
#define p_AllocBin(p, bin, r)
Definition: monomials.h:248
#define pAssume(cond)
Definition: monomials.h:90
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define NULL
Definition: omList.c:12
omBin_t * omBin
Definition: omStructs.h:12
#define p_MemCopy_LengthGeneral(d, s, length)
Definition: p_MemCopy.h:79
poly p_One(const ring r)
Definition: p_polys.cc:1309
poly p_Head0(const poly p, const ring r)
like p_Head, but allow NULL coeff
Definition: p_polys.cc:5030
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1079
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:908
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1086
static void p_LmDelete0(poly p, const ring r)
Definition: p_polys.h:717
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1516
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:488
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:247
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:233
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:412
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:978
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition: p_polys.h:832
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:469
static poly p_GetExp_k_n(poly p, int l, int k, const ring r)
Definition: p_polys.h:1344
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:292
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:873
static unsigned pLength(poly a)
Definition: p_polys.h:191
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1492
#define p_LmTest(p, r)
Definition: p_polys.h:163
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:818
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1479
#define p_Test(p, r)
Definition: p_polys.h:162
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:373
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
void PrintS(const char *s)
Definition: reporter.cc:284
char * StringEndS()
Definition: reporter.cc:151
void PrintLn()
Definition: reporter.cc:310
void Werror(const char *fmt,...)
Definition: reporter.cc:189
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3395
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1363
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:449
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
Definition: ring.cc:5779
rRingOrder_t
order stuff
Definition: ring.h:68
@ ringorder_lp
Definition: ring.h:77
@ ringorder_a
Definition: ring.h:70
@ ringorder_C
Definition: ring.h:73
@ ringorder_Dp
Definition: ring.h:80
@ ringorder_dp
Definition: ring.h:78
@ ringorder_c
Definition: ring.h:72
@ ringorder_rp
Definition: ring.h:79
@ ringorder_Wp
Definition: ring.h:82
@ ringorder_wp
Definition: ring.h:81
BOOLEAN _p_LPLmDivisibleByNoComp(poly a, poly b, const ring r)
Definition: shiftop.cc:794
void p_LPExpVprepend(int *m1ExpV, int *m2ExpV, int m1Length, int m2Length, const ring ri)
Definition: shiftop.cc:536
void p_LPshift(poly p, int sh, const ring ri)
Definition: shiftop.cc:390
BOOLEAN p_LPLmDivisibleBy(poly a, poly b, const ring r)
Definition: shiftop.cc:785
int p_mFirstVblock(poly p, const ring ri)
Definition: shiftop.cc:476
poly shift_pp_Mult_Coeff_mm_DivSelect_STUB(poly p, const poly m, int &shorter, const ring r)
Definition: shiftop.cc:317
int p_mLastVblock(poly p, const ring ri)
Definition: shiftop.cc:419
poly shift_p_Minus_mm_Mult_qq(poly p, poly m, poly q, int &Shorter, const poly spNoether, const ring ri)
Definition: shiftop.cc:269
int id_IsInV(ideal I, const ring r)
Definition: shiftop.cc:676
void p_mLPunshift(poly m, const ring ri)
Definition: shiftop.cc:325
int p_IsInV(poly p, const ring r)
Definition: shiftop.cc:691
poly shift_pp_Mult_mm_Noether_STUB(poly p, const poly m, const poly spNoether, int &ll, const ring ri)
Definition: shiftop.cc:288
BOOLEAN _p_mLPNCGenValid(poly p, const ring r)
Definition: shiftop.cc:621
poly shift_pp_Mult_Coeff_mm_DivSelectMult_STUB(poly p, const poly m, const poly a, const poly b, int &shorter, const ring r)
Definition: shiftop.cc:312
poly shift_pp_mm_Mult(poly p, const poly m, const ring ri)
Definition: shiftop.cc:145
void p_LPunshift(poly p, const ring ri)
Definition: shiftop.cc:351
poly shift_p_mm_Mult(poly p, const poly m, const ring ri)
Definition: shiftop.cc:212
poly p_mLPSubst(poly m, int n, poly e, const ring r)
Definition: shiftop.cc:861
poly shift_p_Mult_mm(poly p, const poly m, const ring ri)
Definition: shiftop.cc:89
poly shift_pp_Mult_mm(poly p, const poly m, const ring ri)
Definition: shiftop.cc:21
BOOLEAN p_LPDivisibleBy(poly a, poly b, const ring r)
Definition: shiftop.cc:774
int p_GetNCGen(poly p, const ring r)
Definition: shiftop.cc:654
void WriteLPExpV(int *expV, ring ri)
Definition: shiftop.cc:571
int p_FirstVblock(poly p, const ring r)
Definition: shiftop.cc:454
int p_LastVblock(poly p, const ring r)
Definition: shiftop.cc:404
ring freeAlgebra(ring r, int d, int ncGenCount)
create the letterplace ring corresponding to r up to degree d
Definition: shiftop.cc:940
poly p_LPVarAt(poly p, int pos, const ring r)
Definition: shiftop.cc:843
void p_LPExpVappend(int *m1ExpV, int *m2ExpV, int m1Length, int m2Length, const ring ri)
Definition: shiftop.cc:509
char * LPExpVString(int *expV, ring ri)
Definition: shiftop.cc:578
int p_mIsInV(poly p, const ring r)
Definition: shiftop.cc:709
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
Definition: shiftop.cc:598
void p_mLPshift(poly m, int sh, const ring ri)
Definition: shiftop.cc:360
poly p_LPSubst(poly p, int n, poly e, const ring r)
Definition: shiftop.cc:910
static BOOLEAN freeAlgebra_weights(const ring old_ring, ring new_ring, int p, int d)
substitute weights from orderings a,wp,Wp by d copies of it at position p
Definition: shiftop.cc:923
#define IDELEMS(i)
Definition: simpleideals.h:23
#define R
Definition: sirandom.c:27
#define degbound(p)
Definition: tgb.cc:153