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