My Project
extra.cc
Go to the documentation of this file.
1 /*****************************************
2 * Computer Algebra System SINGULAR *
3 *****************************************/
4 /*
5 * ABSTRACT: general interface to internals of Singular ("system" command)
6 * jjSYSTEM: official commands, must be documented in the manual,
7 * #defines must be local to each command
8 * jjEXTENDED_SYSTEM: tests, temporary comands etc.
9 */
10 
11 #define HAVE_WALK 1
12 
13 #include "kernel/mod2.h"
14 #include "misc/sirandom.h"
15 #include "resources/omFindExec.h"
16 
17 #ifdef HAVE_CCLUSTER
18 #include "ccluster/ccluster.h"
19 #endif
20 
21 #include "factory/factory.h"
22 
23 #ifdef TIME_WITH_SYS_TIME
24 # include <time.h>
25 # ifdef HAVE_SYS_TIME_H
26 # include <sys/time.h>
27 # endif
28 #else
29 # ifdef HAVE_SYS_TIME_H
30 # include <sys/time.h>
31 # else
32 # include <time.h>
33 # endif
34 #endif
35 #ifdef HAVE_SYS_TIMES_H
36 #include <sys/times.h>
37 #endif
38 
39 #include <unistd.h>
40 
41 #include "misc/options.h"
42 
43 // #include "coeffs/ffields.h"
44 #include "coeffs/coeffs.h"
45 #include "coeffs/mpr_complex.h"
46 
47 
48 #include "resources/feResource.h"
49 #include "polys/monomials/ring.h"
50 #include "kernel/polys.h"
51 
52 #include "polys/monomials/maps.h"
53 #include "polys/matpol.h"
54 
55 #include "polys/weight.h"
56 
57 #ifdef HAVE_SHIFTBBA
58 #include "polys/shiftop.h"
59 #endif
60 
61 #include "coeffs/bigintmat.h"
62 #include "kernel/fast_mult.h"
63 #include "kernel/digitech.h"
65 #include "kernel/ideals.h"
66 #include "kernel/GBEngine/kstd1.h"
67 #include "kernel/GBEngine/syz.h"
68 #include "kernel/GBEngine/kutil.h"
70 
72 
74 
75 // for tests of t-rep-GB
76 #include "kernel/GBEngine/tgb.h"
77 
79 
80 #include "numeric/mpr_base.h"
81 
82 #include "tok.h"
83 #include "ipid.h"
84 #include "lists.h"
85 #include "cntrlc.h"
86 #include "ipshell.h"
87 #include "sdb.h"
88 #include "feOpt.h"
89 #include "fehelp.h"
90 #include "distrib.h"
91 
92 #include "misc_ip.h"
93 
94 #include "attrib.h"
95 
96 #include "links/silink.h"
97 #include "links/ssiLink.h"
98 #include "walk.h"
99 #include "Singular/newstruct.h"
100 #include "Singular/blackbox.h"
101 #include "Singular/pyobject_setup.h"
102 
103 
104 #ifdef HAVE_RINGS
105 #include "kernel/GBEngine/ringgb.h"
106 #endif
107 
108 #ifdef HAVE_F5
109 #include "kernel/GBEngine/f5gb.h"
110 #endif
111 
112 #ifdef HAVE_WALK
113 #include "walk.h"
114 #endif
115 
116 #ifdef HAVE_SPECTRUM
118 #endif
119 
120 #ifdef HAVE_PLURAL
121 #include "polys/nc/nc.h"
122 #include "polys/nc/ncSAMult.h" // for CMultiplier etc classes
123 #include "polys/nc/sca.h"
124 #include "kernel/GBEngine/nc.h"
125 #include "ipconv.h"
126 #ifdef HAVE_RATGRING
128 #endif
129 #endif
130 
131 #ifdef __CYGWIN__ /* only for the DLLTest */
132 /* #include "WinDllTest.h" */
133 #ifdef HAVE_DL
134 #include "polys/mod_raw.h"
135 #endif
136 #endif
137 
138 // Define to enable many more system commands
139 //#undef MAKE_DISTRIBUTION
140 #ifndef MAKE_DISTRIBUTION
141 #define HAVE_EXTENDED_SYSTEM 1
142 #endif
143 
144 #include "polys/flintconv.h"
145 #include "polys/clapconv.h"
146 #include "kernel/GBEngine/kstdfac.h"
147 
148 #include "polys/clapsing.h"
149 
150 #ifdef HAVE_EIGENVAL
151 #include "eigenval_ip.h"
152 #endif
153 
154 #ifdef HAVE_GMS
155 #include "gms.h"
156 #endif
157 
158 #ifdef HAVE_SIMPLEIPC
160 #endif
161 
162 #ifdef HAVE_PCV
163 #include "pcv.h"
164 #endif
165 
166 #ifndef MAKE_DISTRIBUTION
168 #endif
169 
170 /* expects a SINGULAR square matrix with number entries
171  where currRing is expected to be over some field F_p;
172  returns a long** matrix with the "same", i.e.,
173  appropriately mapped entries;
174  leaves singularMatrix unmodified */
175 unsigned long** singularMatrixToLongMatrix(matrix singularMatrix)
176 {
177  int n = singularMatrix->rows();
178  assume(n == singularMatrix->cols());
179  unsigned long **longMatrix = 0;
180  longMatrix = new unsigned long *[n] ;
181  for (int i = 0 ; i < n; i++)
182  longMatrix[i] = new unsigned long [n];
183  number entry;
184  for (int r = 0; r < n; r++)
185  for (int c = 0; c < n; c++)
186  {
187  poly p=MATELEM(singularMatrix, r + 1, c + 1);
188  int entryAsInt;
189  if (p!=NULL)
190  {
191  entry = p_GetCoeff(p, currRing);
192  entryAsInt = n_Int(entry, currRing->cf);
193  if (entryAsInt < 0) entryAsInt += n_GetChar(currRing->cf);
194  }
195  else
196  entryAsInt=0;
197  longMatrix[r][c] = (unsigned long)entryAsInt;
198  }
199  return longMatrix;
200 }
201 
202 /* expects an array of unsigned longs with valid indices 0..degree;
203  returns the following poly, where x denotes the first ring variable
204  of currRing, and d = degree:
205  polyCoeffs[d] * x^d + polyCoeffs[d-1] * x^(d-1) + ... + polyCoeffs[0]
206  leaves polyCoeffs unmodified */
207 poly longCoeffsToSingularPoly(unsigned long *polyCoeffs, const int degree)
208 {
209  poly result = NULL;
210  for (int i = 0; i <= degree; i++)
211  {
212  if ((int)polyCoeffs[i] != 0)
213  {
214  poly term = p_ISet((int)polyCoeffs[i], currRing);
215  if (i > 0)
216  {
217  p_SetExp(term, 1, i, currRing);
218  p_Setm(term, currRing);
219  }
221  }
222  }
223  return result;
224 }
225 
226 //void emStart();
227 /*2
228 * the "system" command
229 */
231 {
232  if(args->Typ() == STRING_CMD)
233  {
234  const char *sys_cmd=(char *)(args->Data());
235  leftv h=args->next;
236 // ONLY documented system calls go here
237 // Undocumented system calls go down into jjEXTENDED_SYSTEM (#ifdef HAVE_EXTENDED_SYSTEM)
238 /*==================== nblocks ==================================*/
239  if (strcmp(sys_cmd, "nblocks") == 0)
240  {
241  ring r;
242  if (h == NULL)
243  {
244  if (currRingHdl != NULL)
245  {
246  r = IDRING(currRingHdl);
247  }
248  else
249  {
250  WerrorS("no ring active");
251  return TRUE;
252  }
253  }
254  else
255  {
256  if (h->Typ() != RING_CMD)
257  {
258  WerrorS("ring expected");
259  return TRUE;
260  }
261  r = (ring) h->Data();
262  }
263  res->rtyp = INT_CMD;
264  res->data = (void*) (long)(rBlocks(r) - 1);
265  return FALSE;
266  }
267 /*==================== version ==================================*/
268  if(strcmp(sys_cmd,"version")==0)
269  {
270  res->rtyp=INT_CMD;
271  res->data=(void *)SINGULAR_VERSION;
272  return FALSE;
273  }
274  else
275 /*==================== alarm ==================================*/
276  if(strcmp(sys_cmd,"alarm")==0)
277  {
278  if ((h!=NULL) &&(h->Typ()==INT_CMD))
279  {
280  // standard variant -> SIGALARM (standard: abort)
281  //alarm((unsigned)h->next->Data());
282  // process time (user +system): SIGVTALARM
283  struct itimerval t,o;
284  memset(&t,0,sizeof(t));
285  t.it_value.tv_sec =(unsigned)((unsigned long)h->Data());
286  setitimer(ITIMER_VIRTUAL,&t,&o);
287  return FALSE;
288  }
289  else
290  WerrorS("int expected");
291  }
292  else
293 /*==================== cpu ==================================*/
294  if(strcmp(sys_cmd,"cpu")==0)
295  {
296  long cpu=1; //feOptValue(FE_OPT_CPUS);
297  #ifdef _SC_NPROCESSORS_ONLN
298  cpu=sysconf(_SC_NPROCESSORS_ONLN);
299  #elif defined(_SC_NPROCESSORS_CONF)
300  cpu=sysconf(_SC_NPROCESSORS_CONF);
301  #endif
302  res->data=(void *)cpu;
303  res->rtyp=INT_CMD;
304  return FALSE;
305  }
306  else
307 /*==================== executable ==================================*/
308  if(strcmp(sys_cmd,"executable")==0)
309  {
310  if ((h!=NULL) && (h->Typ()==STRING_CMD))
311  {
312  char tbuf[MAXPATHLEN];
313  char *s=omFindExec((char*)h->Data(),tbuf);
314  if(s==NULL) s=(char*)"";
315  res->data=(void *)omStrDup(s);
316  res->rtyp=STRING_CMD;
317  return FALSE;
318  }
319  return TRUE;
320  }
321  else
322  /*==================== flatten =============================*/
323  if(strcmp(sys_cmd,"flatten")==0)
324  {
325  if ((h!=NULL) &&(h->Typ()==SMATRIX_CMD))
326  {
327  res->data=(char*)sm_Flatten((ideal)h->Data(),currRing);
328  res->rtyp=SMATRIX_CMD;
329  return FALSE;
330  }
331  else
332  WerrorS("smatrix expected");
333  }
334  else
335  /*==================== unflatten =============================*/
336  if(strcmp(sys_cmd,"unflatten")==0)
337  {
338  const short t1[]={2,SMATRIX_CMD,INT_CMD};
339  if (iiCheckTypes(h,t1,1))
340  {
341  res->data=(char*)sm_UnFlatten((ideal)h->Data(),(int)(long)h->next->Data(),currRing);
342  res->rtyp=SMATRIX_CMD;
343  return res->data==NULL;
344  }
345  else return TRUE;
346  }
347  else
348  /*==================== neworder =============================*/
349  if(strcmp(sys_cmd,"neworder")==0)
350  {
351  if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
352  {
353  res->rtyp=STRING_CMD;
354  res->data=(void *)singclap_neworder((ideal)h->Data(), currRing);
355  return FALSE;
356  }
357  else
358  WerrorS("ideal expected");
359  }
360  else
361 /*===== nc_hilb ===============================================*/
362  // Hilbert series of non-commutative monomial algebras
363  if(strcmp(sys_cmd,"nc_hilb") == 0)
364  {
365  ideal i; int lV;
366  bool ig = FALSE;
367  bool mgrad = FALSE;
368  bool autop = FALSE;
369  int trunDegHs=0;
370  if((h != NULL)&&(h->Typ() == IDEAL_CMD))
371  i = (ideal)h->Data();
372  else
373  {
374  WerrorS("nc_Hilb:ideal expected");
375  return TRUE;
376  }
377  h = h->next;
378  if((h != NULL)&&(h->Typ() == INT_CMD))
379  lV = (int)(long)h->Data();
380  else
381  {
382  WerrorS("nc_Hilb:int expected");
383  return TRUE;
384  }
385  h = h->next;
386  while(h != NULL)
387  {
388  if((int)(long)h->Data() == 1)
389  ig = TRUE;
390  else if((int)(long)h->Data() == 2)
391  mgrad = TRUE;
392  else if(h->Typ()==STRING_CMD)
393  autop = TRUE;
394  else if(h->Typ() == INT_CMD)
395  trunDegHs = (int)(long)h->Data();
396  h = h->next;
397  }
398  if(h != NULL)
399  {
400  WerrorS("nc_Hilb:int 1,2, total degree for the truncation, and a string for printing the details are expected");
401  return TRUE;
402  }
403 
404  HilbertSeries_OrbitData(i, lV, ig, mgrad, autop, trunDegHs);
405  return(FALSE);
406  }
407  else
408 /* ====== verify ============================*/
409  if(strcmp(sys_cmd,"verifyGB")==0)
410  {
411  if (rIsNCRing(currRing))
412  {
413  WerrorS("system(\"verifyGB\",<ideal>,..) expects a commutative ring");
414  return TRUE;
415  }
416  if (h->Typ()!=IDEAL_CMD)
417  {
418  WerrorS("expected system(\"verifyGB\",<ideal>,..)");
419  return TRUE;
420  }
421  ideal F=(ideal)h->Data();
422  #ifdef HAVE_VSPACE
423  int cpus = (long) feOptValue(FE_OPT_CPUS);
424  if (cpus>1)
425  res->data=(char*)(long) kVerify2(F,currRing->qideal);
426  else
427  #endif
428  res->data=(char*)(long) kVerify1(F,currRing->qideal);
429  res->rtyp=INT_CMD;
430  return FALSE;
431  }
432  else
433 /*===== rcolon ===============================================*/
434  if(strcmp(sys_cmd,"rcolon") == 0)
435  {
436  const short t1[]={3,IDEAL_CMD,POLY_CMD,INT_CMD};
437  if (iiCheckTypes(h,t1,1))
438  {
439  ideal i = (ideal)h->Data();
440  h = h->next;
441  poly w=(poly)h->Data();
442  h = h->next;
443  int lV = (int)(long)h->Data();
444  res->rtyp = IDEAL_CMD;
445  res->data = RightColonOperation(i, w, lV);
446  return(FALSE);
447  }
448  else
449  return TRUE;
450  }
451  else
452 
453 /*==================== sh ==================================*/
454  if(strcmp(sys_cmd,"sh")==0)
455  {
456  if (feOptValue(FE_OPT_NO_SHELL))
457  {
458  WerrorS("shell execution is disallowed in restricted mode");
459  return TRUE;
460  }
461  res->rtyp=INT_CMD;
462  if (h==NULL) res->data = (void *)(long) system("sh");
463  else if (h->Typ()==STRING_CMD)
464  res->data = (void*)(long) system((char*)(h->Data()));
465  else
466  WerrorS("string expected");
467  return FALSE;
468  }
469  else
470 /*========reduce procedure like the global one but with jet bounds=======*/
471  if(strcmp(sys_cmd,"reduce_bound")==0)
472  {
473  poly p;
474  ideal pid=NULL;
475  const short t1[]={3,POLY_CMD,IDEAL_CMD,INT_CMD};
476  const short t2[]={3,IDEAL_CMD,IDEAL_CMD,INT_CMD};
477  const short t3[]={3,VECTOR_CMD,MODUL_CMD,INT_CMD};
478  const short t4[]={3,MODUL_CMD,MODUL_CMD,INT_CMD};
479  if ((iiCheckTypes(h,t1,0))||((iiCheckTypes(h,t3,0))))
480  {
481  p = (poly)h->CopyD();
482  }
483  else if ((iiCheckTypes(h,t2,0))||(iiCheckTypes(h,t4,1)))
484  {
485  pid = (ideal)h->CopyD();
486  }
487  else return TRUE;
488  //int htype;
489  res->rtyp= h->Typ(); /*htype*/
490  ideal q = (ideal)h->next->CopyD();
491  int bound = (int)(long)h->next->next->Data();
492  if (pid==NULL) /*(htype == POLY_CMD || htype == VECTOR_CMD)*/
493  res->data = (char *)kNFBound(q,currRing->qideal,p,bound);
494  else /*(htype == IDEAL_CMD || htype == MODUL_CMD)*/
495  res->data = (char *)kNFBound(q,currRing->qideal,pid,bound);
496  return FALSE;
497  }
498  else
499 /*==================== uname ==================================*/
500  if(strcmp(sys_cmd,"uname")==0)
501  {
502  res->rtyp=STRING_CMD;
503  res->data = omStrDup(S_UNAME);
504  return FALSE;
505  }
506  else
507 /*==================== with ==================================*/
508  if(strcmp(sys_cmd,"with")==0)
509  {
510  if (h==NULL)
511  {
512  res->rtyp=STRING_CMD;
513  res->data=(void *)versionString();
514  return FALSE;
515  }
516  else if (h->Typ()==STRING_CMD)
517  {
518  #define TEST_FOR(A) if(strcmp(s,A)==0) res->data=(void *)1; else
519  char *s=(char *)h->Data();
520  res->rtyp=INT_CMD;
521  #ifdef HAVE_DBM
522  TEST_FOR("DBM")
523  #endif
524  #ifdef HAVE_DLD
525  TEST_FOR("DLD")
526  #endif
527  //TEST_FOR("factory")
528  //TEST_FOR("libfac")
529  #ifdef HAVE_READLINE
530  TEST_FOR("readline")
531  #endif
532  #ifdef TEST_MAC_ORDER
533  TEST_FOR("MAC_ORDER")
534  #endif
535  // unconditional since 3-1-0-6
536  TEST_FOR("Namespaces")
537  #ifdef HAVE_DYNAMIC_LOADING
538  TEST_FOR("DynamicLoading")
539  #endif
540  #ifdef HAVE_EIGENVAL
541  TEST_FOR("eigenval")
542  #endif
543  #ifdef HAVE_GMS
544  TEST_FOR("gms")
545  #endif
546  #ifdef OM_NDEBUG
547  TEST_FOR("om_ndebug")
548  #endif
549  #ifdef SING_NDEBUG
550  TEST_FOR("ndebug")
551  #endif
552  {};
553  return FALSE;
554  #undef TEST_FOR
555  }
556  return TRUE;
557  }
558  else
559  /*==================== browsers ==================================*/
560  if (strcmp(sys_cmd,"browsers")==0)
561  {
562  res->rtyp = STRING_CMD;
563  StringSetS("");
565  res->data = StringEndS();
566  return FALSE;
567  }
568  else
569  /*==================== pid ==================================*/
570  if (strcmp(sys_cmd,"pid")==0)
571  {
572  res->rtyp=INT_CMD;
573  res->data=(void *)(long) getpid();
574  return FALSE;
575  }
576  else
577  /*==================== getenv ==================================*/
578  if (strcmp(sys_cmd,"getenv")==0)
579  {
580  if ((h!=NULL) && (h->Typ()==STRING_CMD))
581  {
582  res->rtyp=STRING_CMD;
583  const char *r=getenv((char *)h->Data());
584  if (r==NULL) r="";
585  res->data=(void *)omStrDup(r);
586  return FALSE;
587  }
588  else
589  {
590  WerrorS("string expected");
591  return TRUE;
592  }
593  }
594  else
595  /*==================== setenv ==================================*/
596  if (strcmp(sys_cmd,"setenv")==0)
597  {
598  #ifdef HAVE_SETENV
599  const short t[]={2,STRING_CMD,STRING_CMD};
600  if (iiCheckTypes(h,t,1))
601  {
602  res->rtyp=STRING_CMD;
603  setenv((char *)h->Data(), (char *)h->next->Data(), 1);
604  res->data=(void *)omStrDup((char *)h->next->Data());
606  return FALSE;
607  }
608  else
609  {
610  return TRUE;
611  }
612  #else
613  WerrorS("setenv not supported on this platform");
614  return TRUE;
615  #endif
616  }
617  else
618  /*==================== Singular ==================================*/
619  if (strcmp(sys_cmd, "Singular") == 0)
620  {
621  res->rtyp=STRING_CMD;
622  const char *r=feResource("Singular");
623  if (r == NULL) r="";
624  res->data = (void*) omStrDup( r );
625  return FALSE;
626  }
627  else
628  if (strcmp(sys_cmd, "SingularLib") == 0)
629  {
630  res->rtyp=STRING_CMD;
631  const char *r=feResource("SearchPath");
632  if (r == NULL) r="";
633  res->data = (void*) omStrDup( r );
634  return FALSE;
635  }
636  else
637  /*==================== options ==================================*/
638  if (strstr(sys_cmd, "--") == sys_cmd)
639  {
640  if (strcmp(sys_cmd, "--") == 0)
641  {
643  return FALSE;
644  }
645  feOptIndex opt = feGetOptIndex(&sys_cmd[2]);
646  if (opt == FE_OPT_UNDEF)
647  {
648  Werror("Unknown option %s", sys_cmd);
649  WerrorS("Use 'system(\"--\");' for listing of available options");
650  return TRUE;
651  }
652  // for Untyped Options (help version),
653  // setting it just triggers action
654  if (feOptSpec[opt].type == feOptUntyped)
655  {
656  feSetOptValue(opt,0);
657  return FALSE;
658  }
659  if (h == NULL)
660  {
661  if (feOptSpec[opt].type == feOptString)
662  {
663  res->rtyp = STRING_CMD;
664  const char *r=(const char*)feOptSpec[opt].value;
665  if (r == NULL) r="";
666  res->data = omStrDup(r);
667  }
668  else
669  {
670  res->rtyp = INT_CMD;
671  res->data = feOptSpec[opt].value;
672  }
673  return FALSE;
674  }
675  if (h->Typ() != STRING_CMD &&
676  h->Typ() != INT_CMD)
677  {
678  WerrorS("Need string or int argument to set option value");
679  return TRUE;
680  }
681  const char* errormsg;
682  if (h->Typ() == INT_CMD)
683  {
684  if (feOptSpec[opt].type == feOptString)
685  {
686  Werror("Need string argument to set value of option %s", sys_cmd);
687  return TRUE;
688  }
689  errormsg = feSetOptValue(opt, (int)((long) h->Data()));
690  if (errormsg != NULL)
691  Werror("Option '--%s=%d' %s", sys_cmd, (int) ((long)h->Data()), errormsg);
692  }
693  else
694  {
695  errormsg = feSetOptValue(opt, (char*) h->Data());
696  if (errormsg != NULL)
697  Werror("Option '--%s=%s' %s", sys_cmd, (char*) h->Data(), errormsg);
698  }
699  if (errormsg != NULL) return TRUE;
700  return FALSE;
701  }
702  else
703  /*==================== HC ==================================*/
704  if (strcmp(sys_cmd,"HC")==0)
705  {
706  res->rtyp=INT_CMD;
707  res->data=(void *)(long) HCord;
708  return FALSE;
709  }
710  else
711  /*==================== random ==================================*/
712  if(strcmp(sys_cmd,"random")==0)
713  {
714  const short t[]={1,INT_CMD};
715  if (h!=NULL)
716  {
717  if (iiCheckTypes(h,t,1))
718  {
719  siRandomStart=(int)((long)h->Data());
722  return FALSE;
723  }
724  else
725  {
726  return TRUE;
727  }
728  }
729  res->rtyp=INT_CMD;
730  res->data=(void*)(long) siSeed;
731  return FALSE;
732  }
733  else
734  /*======================= demon_list =====================*/
735  if (strcmp(sys_cmd,"denom_list")==0)
736  {
737  res->rtyp=LIST_CMD;
738  extern lists get_denom_list();
739  res->data=(lists)get_denom_list();
740  return FALSE;
741  }
742  else
743  /*==================== complexNearZero ======================*/
744  if(strcmp(sys_cmd,"complexNearZero")==0)
745  {
746  const short t[]={2,NUMBER_CMD,INT_CMD};
747  if (iiCheckTypes(h,t,1))
748  {
749  if ( !rField_is_long_C(currRing) )
750  {
751  WerrorS( "unsupported ground field!");
752  return TRUE;
753  }
754  else
755  {
756  res->rtyp=INT_CMD;
757  res->data=(void*)complexNearZero((gmp_complex*)h->Data(),
758  (int)((long)(h->next->Data())));
759  return FALSE;
760  }
761  }
762  else
763  {
764  return TRUE;
765  }
766  }
767  else
768  /*==================== getPrecDigits ======================*/
769  if(strcmp(sys_cmd,"getPrecDigits")==0)
770  {
771  if ( (currRing==NULL)
773  {
774  WerrorS( "unsupported ground field!");
775  return TRUE;
776  }
777  res->rtyp=INT_CMD;
778  res->data=(void*)(long)gmp_output_digits;
779  //if (gmp_output_digits!=getGMPFloatDigits())
780  //{ Print("%d, %d\n",getGMPFloatDigits(),gmp_output_digits);}
781  return FALSE;
782  }
783  else
784  /*==================== lduDecomp ======================*/
785  if(strcmp(sys_cmd, "lduDecomp")==0)
786  {
787  const short t[]={1,MATRIX_CMD};
788  if (iiCheckTypes(h,t,1))
789  {
790  matrix aMat = (matrix)h->Data();
791  matrix pMat; matrix lMat; matrix dMat; matrix uMat;
792  poly l; poly u; poly prodLU;
793  lduDecomp(aMat, pMat, lMat, dMat, uMat, l, u, prodLU);
795  L->Init(7);
796  L->m[0].rtyp = MATRIX_CMD; L->m[0].data=(void*)pMat;
797  L->m[1].rtyp = MATRIX_CMD; L->m[1].data=(void*)lMat;
798  L->m[2].rtyp = MATRIX_CMD; L->m[2].data=(void*)dMat;
799  L->m[3].rtyp = MATRIX_CMD; L->m[3].data=(void*)uMat;
800  L->m[4].rtyp = POLY_CMD; L->m[4].data=(void*)l;
801  L->m[5].rtyp = POLY_CMD; L->m[5].data=(void*)u;
802  L->m[6].rtyp = POLY_CMD; L->m[6].data=(void*)prodLU;
803  res->rtyp = LIST_CMD;
804  res->data = (char *)L;
805  return FALSE;
806  }
807  else
808  {
809  return TRUE;
810  }
811  }
812  else
813  /*==================== lduSolve ======================*/
814  if(strcmp(sys_cmd, "lduSolve")==0)
815  {
816  /* for solving a linear equation system A * x = b, via the
817  given LDU-decomposition of the matrix A;
818  There is one valid parametrisation:
819  1) exactly eight arguments P, L, D, U, l, u, lTimesU, b;
820  P, L, D, and U realise the LDU-decomposition of A, that is,
821  P * A = L * D^(-1) * U, and P, L, D, and U satisfy the
822  properties decribed in method 'luSolveViaLDUDecomp' in
823  linearAlgebra.h; see there;
824  l, u, and lTimesU are as described in the same location;
825  b is the right-hand side vector of the linear equation system;
826  The method will return a list of either 1 entry or three entries:
827  1) [0] if there is no solution to the system;
828  2) [1, x, H] if there is at least one solution;
829  x is any solution of the given linear system,
830  H is the matrix with column vectors spanning the homogeneous
831  solution space.
832  The method produces an error if matrix and vector sizes do not
833  fit. */
835  if (!iiCheckTypes(h,t,1))
836  {
837  return TRUE;
838  }
840  {
841  WerrorS("field required");
842  return TRUE;
843  }
844  matrix pMat = (matrix)h->Data();
845  matrix lMat = (matrix)h->next->Data();
846  matrix dMat = (matrix)h->next->next->Data();
847  matrix uMat = (matrix)h->next->next->next->Data();
848  poly l = (poly) h->next->next->next->next->Data();
849  poly u = (poly) h->next->next->next->next->next->Data();
850  poly lTimesU = (poly) h->next->next->next->next->next->next->Data();
851  matrix bVec = (matrix)h->next->next->next->next->next->next->next->Data();
852  matrix xVec; int solvable; matrix homogSolSpace;
853  if (pMat->rows() != pMat->cols())
854  {
855  Werror("first matrix (%d x %d) is not quadratic",
856  pMat->rows(), pMat->cols());
857  return TRUE;
858  }
859  if (lMat->rows() != lMat->cols())
860  {
861  Werror("second matrix (%d x %d) is not quadratic",
862  lMat->rows(), lMat->cols());
863  return TRUE;
864  }
865  if (dMat->rows() != dMat->cols())
866  {
867  Werror("third matrix (%d x %d) is not quadratic",
868  dMat->rows(), dMat->cols());
869  return TRUE;
870  }
871  if (dMat->cols() != uMat->rows())
872  {
873  Werror("third matrix (%d x %d) and fourth matrix (%d x %d) %s",
874  dMat->rows(), dMat->cols(), uMat->rows(), uMat->cols(),
875  "do not t");
876  return TRUE;
877  }
878  if (uMat->rows() != bVec->rows())
879  {
880  Werror("fourth matrix (%d x %d) and vector (%d x 1) do not fit",
881  uMat->rows(), uMat->cols(), bVec->rows());
882  return TRUE;
883  }
884  solvable = luSolveViaLDUDecomp(pMat, lMat, dMat, uMat, l, u, lTimesU,
885  bVec, xVec, homogSolSpace);
886 
887  /* build the return structure; a list with either one or
888  three entries */
890  if (solvable)
891  {
892  ll->Init(3);
893  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
894  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
895  ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
896  }
897  else
898  {
899  ll->Init(1);
900  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
901  }
902  res->rtyp = LIST_CMD;
903  res->data=(char*)ll;
904  return FALSE;
905  }
906  else
907  /*==== countedref: reference and shared ====*/
908  if (strcmp(sys_cmd, "shared") == 0)
909  {
910  #ifndef SI_COUNTEDREF_AUTOLOAD
911  void countedref_shared_load();
913  #endif
914  res->rtyp = NONE;
915  return FALSE;
916  }
917  else if (strcmp(sys_cmd, "reference") == 0)
918  {
919  #ifndef SI_COUNTEDREF_AUTOLOAD
922  #endif
923  res->rtyp = NONE;
924  return FALSE;
925  }
926  else
927 /*==================== semaphore =================*/
928 #ifdef HAVE_SIMPLEIPC
929  if (strcmp(sys_cmd,"semaphore")==0)
930  {
931  if((h!=NULL) && (h->Typ()==STRING_CMD) && (h->next!=NULL) && (h->next->Typ()==INT_CMD))
932  {
933  int v=1;
934  if ((h->next->next!=NULL)&& (h->next->next->Typ()==INT_CMD))
935  v=(int)(long)h->next->next->Data();
936  res->data=(char *)(long)simpleipc_cmd((char *)h->Data(),(int)(long)h->next->Data(),v);
937  res->rtyp=INT_CMD;
938  return FALSE;
939  }
940  else
941  {
942  WerrorS("Usage: system(\"semaphore\",<cmd>,int)");
943  return TRUE;
944  }
945  }
946  else
947 #endif
948 /*==================== reserved port =================*/
949  if (strcmp(sys_cmd,"reserve")==0)
950  {
951  int ssiReservePort(int clients);
952  const short t[]={1,INT_CMD};
953  if (iiCheckTypes(h,t,1))
954  {
955  res->rtyp=INT_CMD;
956  int p=ssiReservePort((int)(long)h->Data());
957  res->data=(void*)(long)p;
958  return (p==0);
959  }
960  return TRUE;
961  }
962  else
963 /*==================== reserved link =================*/
964  if (strcmp(sys_cmd,"reservedLink")==0)
965  {
966  res->rtyp=LINK_CMD;
968  res->data=(void*)p;
969  return (p==NULL);
970  }
971  else
972 /*==================== install newstruct =================*/
973  if (strcmp(sys_cmd,"install")==0)
974  {
975  const short t[]={4,STRING_CMD,STRING_CMD,PROC_CMD,INT_CMD};
976  if (iiCheckTypes(h,t,1))
977  {
978  return newstruct_set_proc((char*)h->Data(),(char*)h->next->Data(),
979  (int)(long)h->next->next->next->Data(),
980  (procinfov)h->next->next->Data());
981  }
982  return TRUE;
983  }
984  else
985 /*==================== newstruct =================*/
986  if (strcmp(sys_cmd,"newstruct")==0)
987  {
988  const short t[]={1,STRING_CMD};
989  if (iiCheckTypes(h,t,1))
990  {
991  int id=0;
992  char *n=(char*)h->Data();
993  blackboxIsCmd(n,id);
994  if (id>0)
995  {
996  blackbox *bb=getBlackboxStuff(id);
997  if (BB_LIKE_LIST(bb))
998  {
999  newstruct_desc desc=(newstruct_desc)bb->data;
1000  newstructShow(desc);
1001  return FALSE;
1002  }
1003  else Werror("'%s' is not a newstruct",n);
1004  }
1005  else Werror("'%s' is not a blackbox object",n);
1006  }
1007  return TRUE;
1008  }
1009  else
1010 /*==================== blackbox =================*/
1011  if (strcmp(sys_cmd,"blackbox")==0)
1012  {
1014  return FALSE;
1015  }
1016  else
1017  /*================= absBiFact ======================*/
1018  #if defined(HAVE_FLINT) || defined(HAVE_NTL)
1019  if (strcmp(sys_cmd, "absFact") == 0)
1020  {
1021  const short t[]={1,POLY_CMD};
1022  if (iiCheckTypes(h,t,1)
1023  && (currRing!=NULL)
1024  && (getCoeffType(currRing->cf)==n_transExt))
1025  {
1026  res->rtyp=LIST_CMD;
1027  intvec *v=NULL;
1028  ideal mipos= NULL;
1029  int n= 0;
1030  ideal f=singclap_absFactorize((poly)(h->Data()), mipos, &v, n, currRing);
1031  if (f==NULL) return TRUE;
1032  ivTest(v);
1034  l->Init(4);
1035  l->m[0].rtyp=IDEAL_CMD;
1036  l->m[0].data=(void *)f;
1037  l->m[1].rtyp=INTVEC_CMD;
1038  l->m[1].data=(void *)v;
1039  l->m[2].rtyp=IDEAL_CMD;
1040  l->m[2].data=(void*) mipos;
1041  l->m[3].rtyp=INT_CMD;
1042  l->m[3].data=(void*) (long) n;
1043  res->data=(void *)l;
1044  return FALSE;
1045  }
1046  else return TRUE;
1047  }
1048  else
1049  #endif
1050  /* =================== LLL via NTL ==============================*/
1051  #ifdef HAVE_NTL
1052  if (strcmp(sys_cmd, "LLL") == 0)
1053  {
1054  if (h!=NULL)
1055  {
1056  res->rtyp=h->Typ();
1057  if (h->Typ()==MATRIX_CMD)
1058  {
1059  res->data=(char *)singntl_LLL((matrix)h->Data(), currRing);
1060  return FALSE;
1061  }
1062  else if (h->Typ()==INTMAT_CMD)
1063  {
1064  res->data=(char *)singntl_LLL((intvec*)h->Data());
1065  return FALSE;
1066  }
1067  else return TRUE;
1068  }
1069  else return TRUE;
1070  }
1071  else
1072  #endif
1073  /* =================== LLL via Flint ==============================*/
1074  #ifdef HAVE_FLINT
1075  #if __FLINT_RELEASE >= 20500
1076  if (strcmp(sys_cmd, "LLL_Flint") == 0)
1077  {
1078  if (h!=NULL)
1079  {
1080  if(h->next == NULL)
1081  {
1082  res->rtyp=h->Typ();
1083  if (h->Typ()==BIGINTMAT_CMD)
1084  {
1085  res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
1086  return FALSE;
1087  }
1088  else if (h->Typ()==INTMAT_CMD)
1089  {
1090  res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
1091  return FALSE;
1092  }
1093  else return TRUE;
1094  }
1095  if(h->next->Typ()!= INT_CMD)
1096  {
1097  WerrorS("matrix,int or bigint,int expected");
1098  return TRUE;
1099  }
1100  if(h->next->Typ()== INT_CMD)
1101  {
1102  if(((int)((long)(h->next->Data())) != 0) && (int)((long)(h->next->Data()) != 1))
1103  {
1104  WerrorS("int is different from 0, 1");
1105  return TRUE;
1106  }
1107  res->rtyp=h->Typ();
1108  if((long)(h->next->Data()) == 0)
1109  {
1110  if (h->Typ()==BIGINTMAT_CMD)
1111  {
1112  res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
1113  return FALSE;
1114  }
1115  else if (h->Typ()==INTMAT_CMD)
1116  {
1117  res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
1118  return FALSE;
1119  }
1120  else return TRUE;
1121  }
1122  // This will give also the transformation matrix U s.t. res = U * m
1123  if((long)(h->next->Data()) == 1)
1124  {
1125  if (h->Typ()==BIGINTMAT_CMD)
1126  {
1127  bigintmat* m = (bigintmat*)h->Data();
1128  bigintmat* T = new bigintmat(m->rows(),m->rows(),m->basecoeffs());
1129  for(int i = 1; i<=m->rows(); i++)
1130  {
1131  n_Delete(&(BIMATELEM(*T,i,i)),T->basecoeffs());
1132  BIMATELEM(*T,i,i)=n_Init(1, T->basecoeffs());
1133  }
1134  m = singflint_LLL(m,T);
1136  L->Init(2);
1137  L->m[0].rtyp = BIGINTMAT_CMD; L->m[0].data = (void*)m;
1138  L->m[1].rtyp = BIGINTMAT_CMD; L->m[1].data = (void*)T;
1139  res->data=L;
1140  res->rtyp=LIST_CMD;
1141  return FALSE;
1142  }
1143  else if (h->Typ()==INTMAT_CMD)
1144  {
1145  intvec* m = (intvec*)h->Data();
1146  intvec* T = new intvec(m->rows(),m->rows(),(int)0);
1147  for(int i = 1; i<=m->rows(); i++)
1148  IMATELEM(*T,i,i)=1;
1149  m = singflint_LLL(m,T);
1151  L->Init(2);
1152  L->m[0].rtyp = INTMAT_CMD; L->m[0].data = (void*)m;
1153  L->m[1].rtyp = INTMAT_CMD; L->m[1].data = (void*)T;
1154  res->data=L;
1155  res->rtyp=LIST_CMD;
1156  return FALSE;
1157  }
1158  else return TRUE;
1159  }
1160  }
1161 
1162  }
1163  else return TRUE;
1164  }
1165  else
1166  #endif
1167  #endif
1168  /*==================== pcv ==================================*/
1169  #ifdef HAVE_PCV
1170  if(strcmp(sys_cmd,"pcvLAddL")==0)
1171  {
1172  return pcvLAddL(res,h);
1173  }
1174  else
1175  if(strcmp(sys_cmd,"pcvPMulL")==0)
1176  {
1177  return pcvPMulL(res,h);
1178  }
1179  else
1180  if(strcmp(sys_cmd,"pcvMinDeg")==0)
1181  {
1182  return pcvMinDeg(res,h);
1183  }
1184  else
1185  if(strcmp(sys_cmd,"pcvP2CV")==0)
1186  {
1187  return pcvP2CV(res,h);
1188  }
1189  else
1190  if(strcmp(sys_cmd,"pcvCV2P")==0)
1191  {
1192  return pcvCV2P(res,h);
1193  }
1194  else
1195  if(strcmp(sys_cmd,"pcvDim")==0)
1196  {
1197  return pcvDim(res,h);
1198  }
1199  else
1200  if(strcmp(sys_cmd,"pcvBasis")==0)
1201  {
1202  return pcvBasis(res,h);
1203  }
1204  else
1205  #endif
1206  /*==================== hessenberg/eigenvalues ==================================*/
1207  #ifdef HAVE_EIGENVAL
1208  if(strcmp(sys_cmd,"hessenberg")==0)
1209  {
1210  return evHessenberg(res,h);
1211  }
1212  else
1213  #endif
1214  /*==================== eigenvalues ==================================*/
1215  #ifdef HAVE_EIGENVAL
1216  if(strcmp(sys_cmd,"eigenvals")==0)
1217  {
1218  return evEigenvals(res,h);
1219  }
1220  else
1221  #endif
1222  /*==================== rowelim ==================================*/
1223  #ifdef HAVE_EIGENVAL
1224  if(strcmp(sys_cmd,"rowelim")==0)
1225  {
1226  return evRowElim(res,h);
1227  }
1228  else
1229  #endif
1230  /*==================== rowcolswap ==================================*/
1231  #ifdef HAVE_EIGENVAL
1232  if(strcmp(sys_cmd,"rowcolswap")==0)
1233  {
1234  return evSwap(res,h);
1235  }
1236  else
1237  #endif
1238  /*==================== Gauss-Manin system ==================================*/
1239  #ifdef HAVE_GMS
1240  if(strcmp(sys_cmd,"gmsnf")==0)
1241  {
1242  return gmsNF(res,h);
1243  }
1244  else
1245  #endif
1246  /*==================== contributors =============================*/
1247  if(strcmp(sys_cmd,"contributors") == 0)
1248  {
1249  res->rtyp=STRING_CMD;
1250  res->data=(void *)omStrDup(
1251  "Olaf Bachmann, Michael Brickenstein, Hubert Grassmann, Kai Krueger, Victor Levandovskyy, Wolfgang Neumann, Thomas Nuessler, Wilfred Pohl, Jens Schmidt, Mathias Schulze, Thomas Siebert, Ruediger Stobbe, Moritz Wenk, Tim Wichmann");
1252  return FALSE;
1253  }
1254  else
1255  /*==================== spectrum =============================*/
1256  #ifdef HAVE_SPECTRUM
1257  if(strcmp(sys_cmd,"spectrum") == 0)
1258  {
1259  if ((h==NULL) || (h->Typ()!=POLY_CMD))
1260  {
1261  WerrorS("poly expected");
1262  return TRUE;
1263  }
1264  if (h->next==NULL)
1265  return spectrumProc(res,h);
1266  if (h->next->Typ()!=INT_CMD)
1267  {
1268  WerrorS("poly,int expected");
1269  return TRUE;
1270  }
1271  if(((long)h->next->Data())==1L)
1272  return spectrumfProc(res,h);
1273  return spectrumProc(res,h);
1274  }
1275  else
1276  /*==================== semic =============================*/
1277  if(strcmp(sys_cmd,"semic") == 0)
1278  {
1279  if ((h->next!=NULL)
1280  && (h->Typ()==LIST_CMD)
1281  && (h->next->Typ()==LIST_CMD))
1282  {
1283  if (h->next->next==NULL)
1284  return semicProc(res,h,h->next);
1285  else if (h->next->next->Typ()==INT_CMD)
1286  return semicProc3(res,h,h->next,h->next->next);
1287  }
1288  return TRUE;
1289  }
1290  else
1291  /*==================== spadd =============================*/
1292  if(strcmp(sys_cmd,"spadd") == 0)
1293  {
1294  const short t[]={2,LIST_CMD,LIST_CMD};
1295  if (iiCheckTypes(h,t,1))
1296  {
1297  return spaddProc(res,h,h->next);
1298  }
1299  return TRUE;
1300  }
1301  else
1302  /*==================== spmul =============================*/
1303  if(strcmp(sys_cmd,"spmul") == 0)
1304  {
1305  const short t[]={2,LIST_CMD,INT_CMD};
1306  if (iiCheckTypes(h,t,1))
1307  {
1308  return spmulProc(res,h,h->next);
1309  }
1310  return TRUE;
1311  }
1312  else
1313  #endif
1314 /*==================== tensorModuleMult ========================= */
1315  #define HAVE_SHEAFCOH_TRICKS 1
1316 
1317  #ifdef HAVE_SHEAFCOH_TRICKS
1318  if(strcmp(sys_cmd,"tensorModuleMult")==0)
1319  {
1320  const short t[]={2,INT_CMD,MODUL_CMD};
1321  // WarnS("tensorModuleMult!");
1322  if (iiCheckTypes(h,t,1))
1323  {
1324  int m = (int)( (long)h->Data() );
1325  ideal M = (ideal)h->next->Data();
1326  res->rtyp=MODUL_CMD;
1327  res->data=(void *)id_TensorModuleMult(m, M, currRing);
1328  return FALSE;
1329  }
1330  return TRUE;
1331  }
1332  else
1333  #endif
1334  /*==================== twostd =================*/
1335  #ifdef HAVE_PLURAL
1336  if (strcmp(sys_cmd, "twostd") == 0)
1337  {
1338  ideal I;
1339  if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
1340  {
1341  I=(ideal)h->CopyD();
1342  res->rtyp=IDEAL_CMD;
1343  if (rIsPluralRing(currRing)) res->data=twostd(I);
1344  else res->data=I;
1346  setFlag(res,FLAG_STD);
1347  }
1348  else return TRUE;
1349  return FALSE;
1350  }
1351  else
1352  #endif
1353  /*==================== lie bracket =================*/
1354  #ifdef HAVE_PLURAL
1355  if (strcmp(sys_cmd, "bracket") == 0)
1356  {
1357  const short t[]={2,POLY_CMD,POLY_CMD};
1358  if (iiCheckTypes(h,t,1))
1359  {
1360  poly p=(poly)h->CopyD();
1361  h=h->next;
1362  poly q=(poly)h->Data();
1363  res->rtyp=POLY_CMD;
1365  return FALSE;
1366  }
1367  return TRUE;
1368  }
1369  else
1370  #endif
1371  /*==================== env ==================================*/
1372  #ifdef HAVE_PLURAL
1373  if (strcmp(sys_cmd, "env")==0)
1374  {
1375  if ((h!=NULL) && (h->Typ()==RING_CMD))
1376  {
1377  ring r = (ring)h->Data();
1378  res->data = rEnvelope(r);
1379  res->rtyp = RING_CMD;
1380  return FALSE;
1381  }
1382  else
1383  {
1384  WerrorS("`system(\"env\",<ring>)` expected");
1385  return TRUE;
1386  }
1387  }
1388  else
1389  #endif
1390 /* ============ opp ======================== */
1391  #ifdef HAVE_PLURAL
1392  if (strcmp(sys_cmd, "opp")==0)
1393  {
1394  if ((h!=NULL) && (h->Typ()==RING_CMD))
1395  {
1396  ring r=(ring)h->Data();
1397  res->data=rOpposite(r);
1398  res->rtyp=RING_CMD;
1399  return FALSE;
1400  }
1401  else
1402  {
1403  WerrorS("`system(\"opp\",<ring>)` expected");
1404  return TRUE;
1405  }
1406  }
1407  else
1408  #endif
1409  /*==================== oppose ==================================*/
1410  #ifdef HAVE_PLURAL
1411  if (strcmp(sys_cmd, "oppose")==0)
1412  {
1413  if ((h!=NULL) && (h->Typ()==RING_CMD)
1414  && (h->next!= NULL))
1415  {
1416  ring Rop = (ring)h->Data();
1417  h = h->next;
1418  idhdl w;
1419  if ((w=Rop->idroot->get(h->Name(),myynest))!=NULL)
1420  {
1421  poly p = (poly)IDDATA(w);
1422  res->data = pOppose(Rop, p, currRing); // into CurrRing?
1423  res->rtyp = POLY_CMD;
1424  return FALSE;
1425  }
1426  }
1427  else
1428  {
1429  WerrorS("`system(\"oppose\",<ring>,<poly>)` expected");
1430  return TRUE;
1431  }
1432  }
1433  else
1434  #endif
1435  /*==================== walk stuff =================*/
1436  /*==================== walkNextWeight =================*/
1437  #ifdef HAVE_WALK
1438  #ifdef OWNW
1439  if (strcmp(sys_cmd, "walkNextWeight") == 0)
1440  {
1441  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1442  if (!iiCheckTypes(h,t,1)) return TRUE;
1443  if (((intvec*) h->Data())->length() != currRing->N ||
1444  ((intvec*) h->next->Data())->length() != currRing->N)
1445  {
1446  Werror("system(\"walkNextWeight\" ...) intvecs not of length %d\n",
1447  currRing->N);
1448  return TRUE;
1449  }
1450  res->data = (void*) walkNextWeight(((intvec*) h->Data()),
1451  ((intvec*) h->next->Data()),
1452  (ideal) h->next->next->Data());
1453  if (res->data == NULL || res->data == (void*) 1L)
1454  {
1455  res->rtyp = INT_CMD;
1456  }
1457  else
1458  {
1459  res->rtyp = INTVEC_CMD;
1460  }
1461  return FALSE;
1462  }
1463  else
1464  #endif
1465  #endif
1466  /*==================== walkNextWeight =================*/
1467  #ifdef HAVE_WALK
1468  #ifdef OWNW
1469  if (strcmp(sys_cmd, "walkInitials") == 0)
1470  {
1471  if (h == NULL || h->Typ() != IDEAL_CMD)
1472  {
1473  WerrorS("system(\"walkInitials\", ideal) expected");
1474  return TRUE;
1475  }
1476  res->data = (void*) walkInitials((ideal) h->Data());
1477  res->rtyp = IDEAL_CMD;
1478  return FALSE;
1479  }
1480  else
1481  #endif
1482  #endif
1483  /*==================== walkAddIntVec =================*/
1484  #ifdef HAVE_WALK
1485  #ifdef WAIV
1486  if (strcmp(sys_cmd, "walkAddIntVec") == 0)
1487  {
1488  const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1489  if (!iiCheckTypes(h,t,1)) return TRUE;
1490  intvec* arg1 = (intvec*) h->Data();
1491  intvec* arg2 = (intvec*) h->next->Data();
1492  res->data = (intvec*) walkAddIntVec(arg1, arg2);
1493  res->rtyp = INTVEC_CMD;
1494  return FALSE;
1495  }
1496  else
1497  #endif
1498  #endif
1499  /*==================== MwalkNextWeight =================*/
1500  #ifdef HAVE_WALK
1501  #ifdef MwaklNextWeight
1502  if (strcmp(sys_cmd, "MwalkNextWeight") == 0)
1503  {
1504  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1505  if (!iiCheckTypes(h,t,1)) return TRUE;
1506  if (((intvec*) h->Data())->length() != currRing->N ||
1507  ((intvec*) h->next->Data())->length() != currRing->N)
1508  {
1509  Werror("system(\"MwalkNextWeight\" ...) intvecs not of length %d\n",
1510  currRing->N);
1511  return TRUE;
1512  }
1513  intvec* arg1 = (intvec*) h->Data();
1514  intvec* arg2 = (intvec*) h->next->Data();
1515  ideal arg3 = (ideal) h->next->next->Data();
1516  intvec* result = (intvec*) MwalkNextWeight(arg1, arg2, arg3);
1517  res->rtyp = INTVEC_CMD;
1518  res->data = result;
1519  return FALSE;
1520  }
1521  else
1522  #endif //MWalkNextWeight
1523  #endif
1524  /*==================== Mivdp =================*/
1525  #ifdef HAVE_WALK
1526  if(strcmp(sys_cmd, "Mivdp") == 0)
1527  {
1528  if (h == NULL || h->Typ() != INT_CMD)
1529  {
1530  WerrorS("system(\"Mivdp\", int) expected");
1531  return TRUE;
1532  }
1533  if ((int) ((long)(h->Data())) != currRing->N)
1534  {
1535  Werror("system(\"Mivdp\" ...) intvecs not of length %d\n",
1536  currRing->N);
1537  return TRUE;
1538  }
1539  int arg1 = (int) ((long)(h->Data()));
1540  intvec* result = (intvec*) Mivdp(arg1);
1541  res->rtyp = INTVEC_CMD;
1542  res->data = result;
1543  return FALSE;
1544  }
1545  else
1546  #endif
1547  /*==================== Mivlp =================*/
1548  #ifdef HAVE_WALK
1549  if(strcmp(sys_cmd, "Mivlp") == 0)
1550  {
1551  if (h == NULL || h->Typ() != INT_CMD)
1552  {
1553  WerrorS("system(\"Mivlp\", int) expected");
1554  return TRUE;
1555  }
1556  if ((int) ((long)(h->Data())) != currRing->N)
1557  {
1558  Werror("system(\"Mivlp\" ...) intvecs not of length %d\n",
1559  currRing->N);
1560  return TRUE;
1561  }
1562  int arg1 = (int) ((long)(h->Data()));
1563  intvec* result = (intvec*) Mivlp(arg1);
1564  res->rtyp = INTVEC_CMD;
1565  res->data = result;
1566  return FALSE;
1567  }
1568  else
1569  #endif
1570  /*==================== MpDiv =================*/
1571  #ifdef HAVE_WALK
1572  #ifdef MpDiv
1573  if(strcmp(sys_cmd, "MpDiv") == 0)
1574  {
1575  const short t[]={2,POLY_CMD,POLY_CMD};
1576  if (!iiCheckTypes(h,t,1)) return TRUE;
1577  poly arg1 = (poly) h->Data();
1578  poly arg2 = (poly) h->next->Data();
1579  poly result = MpDiv(arg1, arg2);
1580  res->rtyp = POLY_CMD;
1581  res->data = result;
1582  return FALSE;
1583  }
1584  else
1585  #endif
1586  #endif
1587  /*==================== MpMult =================*/
1588  #ifdef HAVE_WALK
1589  #ifdef MpMult
1590  if(strcmp(sys_cmd, "MpMult") == 0)
1591  {
1592  const short t[]={2,POLY_CMD,POLY_CMD};
1593  if (!iiCheckTypes(h,t,1)) return TRUE;
1594  poly arg1 = (poly) h->Data();
1595  poly arg2 = (poly) h->next->Data();
1596  poly result = MpMult(arg1, arg2);
1597  res->rtyp = POLY_CMD;
1598  res->data = result;
1599  return FALSE;
1600  }
1601  else
1602  #endif
1603  #endif
1604  /*==================== MivSame =================*/
1605  #ifdef HAVE_WALK
1606  if (strcmp(sys_cmd, "MivSame") == 0)
1607  {
1608  const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1609  if (!iiCheckTypes(h,t,1)) return TRUE;
1610  /*
1611  if (((intvec*) h->Data())->length() != currRing->N ||
1612  ((intvec*) h->next->Data())->length() != currRing->N)
1613  {
1614  Werror("system(\"MivSame\" ...) intvecs not of length %d\n",
1615  currRing->N);
1616  return TRUE;
1617  }
1618  */
1619  intvec* arg1 = (intvec*) h->Data();
1620  intvec* arg2 = (intvec*) h->next->Data();
1621  /*
1622  poly result = (poly) MivSame(arg1, arg2);
1623  res->rtyp = POLY_CMD;
1624  res->data = (poly) result;
1625  */
1626  res->rtyp = INT_CMD;
1627  res->data = (void*)(long) MivSame(arg1, arg2);
1628  return FALSE;
1629  }
1630  else
1631  #endif
1632  /*==================== M3ivSame =================*/
1633  #ifdef HAVE_WALK
1634  if (strcmp(sys_cmd, "M3ivSame") == 0)
1635  {
1636  const short t[]={3,INTVEC_CMD,INTVEC_CMD,INTVEC_CMD};
1637  if (!iiCheckTypes(h,t,1)) return TRUE;
1638  /*
1639  if (((intvec*) h->Data())->length() != currRing->N ||
1640  ((intvec*) h->next->Data())->length() != currRing->N ||
1641  ((intvec*) h->next->next->Data())->length() != currRing->N )
1642  {
1643  Werror("system(\"M3ivSame\" ...) intvecs not of length %d\n",
1644  currRing->N);
1645  return TRUE;
1646  }
1647  */
1648  intvec* arg1 = (intvec*) h->Data();
1649  intvec* arg2 = (intvec*) h->next->Data();
1650  intvec* arg3 = (intvec*) h->next->next->Data();
1651  /*
1652  poly result = (poly) M3ivSame(arg1, arg2, arg3);
1653  res->rtyp = POLY_CMD;
1654  res->data = (poly) result;
1655  */
1656  res->rtyp = INT_CMD;
1657  res->data = (void*)(long) M3ivSame(arg1, arg2, arg3);
1658  return FALSE;
1659  }
1660  else
1661  #endif
1662  /*==================== MwalkInitialForm =================*/
1663  #ifdef HAVE_WALK
1664  if(strcmp(sys_cmd, "MwalkInitialForm") == 0)
1665  {
1666  const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1667  if (!iiCheckTypes(h,t,1)) return TRUE;
1668  if(((intvec*) h->next->Data())->length() != currRing->N)
1669  {
1670  Werror("system \"MwalkInitialForm\"...) intvec not of length %d\n",
1671  currRing->N);
1672  return TRUE;
1673  }
1674  ideal id = (ideal) h->Data();
1675  intvec* int_w = (intvec*) h->next->Data();
1676  ideal result = (ideal) MwalkInitialForm(id, int_w);
1677  res->rtyp = IDEAL_CMD;
1678  res->data = result;
1679  return FALSE;
1680  }
1681  else
1682  #endif
1683  /*==================== MivMatrixOrder =================*/
1684  #ifdef HAVE_WALK
1685  /************** Perturbation walk **********/
1686  if(strcmp(sys_cmd, "MivMatrixOrder") == 0)
1687  {
1688  if(h==NULL || h->Typ() != INTVEC_CMD)
1689  {
1690  WerrorS("system(\"MivMatrixOrder\",intvec) expected");
1691  return TRUE;
1692  }
1693  intvec* arg1 = (intvec*) h->Data();
1694  intvec* result = MivMatrixOrder(arg1);
1695  res->rtyp = INTVEC_CMD;
1696  res->data = result;
1697  return FALSE;
1698  }
1699  else
1700  #endif
1701  /*==================== MivMatrixOrderdp =================*/
1702  #ifdef HAVE_WALK
1703  if(strcmp(sys_cmd, "MivMatrixOrderdp") == 0)
1704  {
1705  if(h==NULL || h->Typ() != INT_CMD)
1706  {
1707  WerrorS("system(\"MivMatrixOrderdp\",intvec) expected");
1708  return TRUE;
1709  }
1710  int arg1 = (int) ((long)(h->Data()));
1711  intvec* result = (intvec*) MivMatrixOrderdp(arg1);
1712  res->rtyp = INTVEC_CMD;
1713  res->data = result;
1714  return FALSE;
1715  }
1716  else
1717  #endif
1718  /*==================== MPertVectors =================*/
1719  #ifdef HAVE_WALK
1720  if(strcmp(sys_cmd, "MPertVectors") == 0)
1721  {
1722  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1723  if (!iiCheckTypes(h,t,1)) return TRUE;
1724  ideal arg1 = (ideal) h->Data();
1725  intvec* arg2 = (intvec*) h->next->Data();
1726  int arg3 = (int) ((long)(h->next->next->Data()));
1727  intvec* result = (intvec*) MPertVectors(arg1, arg2, arg3);
1728  res->rtyp = INTVEC_CMD;
1729  res->data = result;
1730  return FALSE;
1731  }
1732  else
1733  #endif
1734  /*==================== MPertVectorslp =================*/
1735  #ifdef HAVE_WALK
1736  if(strcmp(sys_cmd, "MPertVectorslp") == 0)
1737  {
1738  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1739  if (!iiCheckTypes(h,t,1)) return TRUE;
1740  ideal arg1 = (ideal) h->Data();
1741  intvec* arg2 = (intvec*) h->next->Data();
1742  int arg3 = (int) ((long)(h->next->next->Data()));
1743  intvec* result = (intvec*) MPertVectorslp(arg1, arg2, arg3);
1744  res->rtyp = INTVEC_CMD;
1745  res->data = result;
1746  return FALSE;
1747  }
1748  else
1749  #endif
1750  /************** fractal walk **********/
1751  #ifdef HAVE_WALK
1752  if(strcmp(sys_cmd, "Mfpertvector") == 0)
1753  {
1754  const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1755  if (!iiCheckTypes(h,t,1)) return TRUE;
1756  ideal arg1 = (ideal) h->Data();
1757  intvec* arg2 = (intvec*) h->next->Data();
1758  intvec* result = Mfpertvector(arg1, arg2);
1759  res->rtyp = INTVEC_CMD;
1760  res->data = result;
1761  return FALSE;
1762  }
1763  else
1764  #endif
1765  /*==================== MivUnit =================*/
1766  #ifdef HAVE_WALK
1767  if(strcmp(sys_cmd, "MivUnit") == 0)
1768  {
1769  const short t[]={1,INT_CMD};
1770  if (!iiCheckTypes(h,t,1)) return TRUE;
1771  int arg1 = (int) ((long)(h->Data()));
1772  intvec* result = (intvec*) MivUnit(arg1);
1773  res->rtyp = INTVEC_CMD;
1774  res->data = result;
1775  return FALSE;
1776  }
1777  else
1778  #endif
1779  /*==================== MivWeightOrderlp =================*/
1780  #ifdef HAVE_WALK
1781  if(strcmp(sys_cmd, "MivWeightOrderlp") == 0)
1782  {
1783  const short t[]={1,INTVEC_CMD};
1784  if (!iiCheckTypes(h,t,1)) return TRUE;
1785  intvec* arg1 = (intvec*) h->Data();
1786  intvec* result = MivWeightOrderlp(arg1);
1787  res->rtyp = INTVEC_CMD;
1788  res->data = result;
1789  return FALSE;
1790  }
1791  else
1792  #endif
1793  /*==================== MivWeightOrderdp =================*/
1794  #ifdef HAVE_WALK
1795  if(strcmp(sys_cmd, "MivWeightOrderdp") == 0)
1796  {
1797  if(h==NULL || h->Typ() != INTVEC_CMD)
1798  {
1799  WerrorS("system(\"MivWeightOrderdp\",intvec) expected");
1800  return TRUE;
1801  }
1802  intvec* arg1 = (intvec*) h->Data();
1803  //int arg2 = (int) h->next->Data();
1804  intvec* result = MivWeightOrderdp(arg1);
1805  res->rtyp = INTVEC_CMD;
1806  res->data = result;
1807  return FALSE;
1808  }
1809  else
1810  #endif
1811  /*==================== MivMatrixOrderlp =================*/
1812  #ifdef HAVE_WALK
1813  if(strcmp(sys_cmd, "MivMatrixOrderlp") == 0)
1814  {
1815  if(h==NULL || h->Typ() != INT_CMD)
1816  {
1817  WerrorS("system(\"MivMatrixOrderlp\",int) expected");
1818  return TRUE;
1819  }
1820  int arg1 = (int) ((long)(h->Data()));
1821  intvec* result = (intvec*) MivMatrixOrderlp(arg1);
1822  res->rtyp = INTVEC_CMD;
1823  res->data = result;
1824  return FALSE;
1825  }
1826  else
1827  #endif
1828  /*==================== MkInterRedNextWeight =================*/
1829  #ifdef HAVE_WALK
1830  if (strcmp(sys_cmd, "MkInterRedNextWeight") == 0)
1831  {
1832  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1833  if (!iiCheckTypes(h,t,1)) return TRUE;
1834  if (((intvec*) h->Data())->length() != currRing->N ||
1835  ((intvec*) h->next->Data())->length() != currRing->N)
1836  {
1837  Werror("system(\"MkInterRedNextWeight\" ...) intvecs not of length %d\n",
1838  currRing->N);
1839  return TRUE;
1840  }
1841  intvec* arg1 = (intvec*) h->Data();
1842  intvec* arg2 = (intvec*) h->next->Data();
1843  ideal arg3 = (ideal) h->next->next->Data();
1844  intvec* result = (intvec*) MkInterRedNextWeight(arg1, arg2, arg3);
1845  res->rtyp = INTVEC_CMD;
1846  res->data = result;
1847  return FALSE;
1848  }
1849  else
1850  #endif
1851  /*==================== MPertNextWeight =================*/
1852  #ifdef HAVE_WALK
1853  #ifdef MPertNextWeight
1854  if (strcmp(sys_cmd, "MPertNextWeight") == 0)
1855  {
1856  const short t[]={3,INTVEC_CMD,IDEAL_CMD,INT_CMD};
1857  if (!iiCheckTypes(h,t,1)) return TRUE;
1858  if (((intvec*) h->Data())->length() != currRing->N)
1859  {
1860  Werror("system(\"MPertNextWeight\" ...) intvecs not of length %d\n",
1861  currRing->N);
1862  return TRUE;
1863  }
1864  intvec* arg1 = (intvec*) h->Data();
1865  ideal arg2 = (ideal) h->next->Data();
1866  int arg3 = (int) h->next->next->Data();
1867  intvec* result = (intvec*) MPertNextWeight(arg1, arg2, arg3);
1868  res->rtyp = INTVEC_CMD;
1869  res->data = result;
1870  return FALSE;
1871  }
1872  else
1873  #endif //MPertNextWeight
1874  #endif
1875  /*==================== Mivperttarget =================*/
1876  #ifdef HAVE_WALK
1877  #ifdef Mivperttarget
1878  if (strcmp(sys_cmd, "Mivperttarget") == 0)
1879  {
1880  const short t[]={2,IDEAL_CMD,INT_CMD};
1881  if (!iiCheckTypes(h,t,1)) return TRUE;
1882  ideal arg1 = (ideal) h->Data();
1883  int arg2 = (int) h->next->Data();
1884  intvec* result = (intvec*) Mivperttarget(arg1, arg2);
1885  res->rtyp = INTVEC_CMD;
1886  res->data = result;
1887  return FALSE;
1888  }
1889  else
1890  #endif //Mivperttarget
1891  #endif
1892  /*==================== Mwalk =================*/
1893  #ifdef HAVE_WALK
1894  if (strcmp(sys_cmd, "Mwalk") == 0)
1895  {
1896  const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD,INT_CMD,INT_CMD};
1897  if (!iiCheckTypes(h,t,1)) return TRUE;
1898  if (((intvec*) h->next->Data())->length() != currRing->N &&
1899  ((intvec*) h->next->next->Data())->length() != currRing->N )
1900  {
1901  Werror("system(\"Mwalk\" ...) intvecs not of length %d\n",
1902  currRing->N);
1903  return TRUE;
1904  }
1905  ideal arg1 = (ideal) h->CopyD();
1906  intvec* arg2 = (intvec*) h->next->Data();
1907  intvec* arg3 = (intvec*) h->next->next->Data();
1908  ring arg4 = (ring) h->next->next->next->Data();
1909  int arg5 = (int) (long) h->next->next->next->next->Data();
1910  int arg6 = (int) (long) h->next->next->next->next->next->Data();
1911  ideal result = (ideal) Mwalk(arg1, arg2, arg3, arg4, arg5, arg6);
1912  res->rtyp = IDEAL_CMD;
1913  res->data = result;
1914  return FALSE;
1915  }
1916  else
1917  #endif
1918  /*==================== Mpwalk =================*/
1919  #ifdef HAVE_WALK
1920  #ifdef MPWALK_ORIG
1921  if (strcmp(sys_cmd, "Mwalk") == 0)
1922  {
1923  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD};
1924  if (!iiCheckTypes(h,t,1)) return TRUE;
1925  if ((((intvec*) h->next->Data())->length() != currRing->N &&
1926  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
1927  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
1928  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N)))
1929  {
1930  Werror("system(\"Mwalk\" ...) intvecs not of length %d or %d\n",
1931  currRing->N,(currRing->N)*(currRing->N));
1932  return TRUE;
1933  }
1934  ideal arg1 = (ideal) h->Data();
1935  intvec* arg2 = (intvec*) h->next->Data();
1936  intvec* arg3 = (intvec*) h->next->next->Data();
1937  ring arg4 = (ring) h->next->next->next->Data();
1938  ideal result = (ideal) Mwalk(arg1, arg2, arg3,arg4);
1939  res->rtyp = IDEAL_CMD;
1940  res->data = result;
1941  return FALSE;
1942  }
1943  else
1944  #else
1945  if (strcmp(sys_cmd, "Mpwalk") == 0)
1946  {
1948  if (!iiCheckTypes(h,t,1)) return TRUE;
1949  if(((intvec*) h->next->next->next->Data())->length() != currRing->N &&
1950  ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
1951  {
1952  Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n",currRing->N);
1953  return TRUE;
1954  }
1955  ideal arg1 = (ideal) h->Data();
1956  int arg2 = (int) (long) h->next->Data();
1957  int arg3 = (int) (long) h->next->next->Data();
1958  intvec* arg4 = (intvec*) h->next->next->next->Data();
1959  intvec* arg5 = (intvec*) h->next->next->next->next->Data();
1960  int arg6 = (int) (long) h->next->next->next->next->next->Data();
1961  int arg7 = (int) (long) h->next->next->next->next->next->next->Data();
1962  int arg8 = (int) (long) h->next->next->next->next->next->next->next->Data();
1963  ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
1964  res->rtyp = IDEAL_CMD;
1965  res->data = result;
1966  return FALSE;
1967  }
1968  else
1969  #endif
1970  #endif
1971  /*==================== Mrwalk =================*/
1972  #ifdef HAVE_WALK
1973  if (strcmp(sys_cmd, "Mrwalk") == 0)
1974  {
1976  if (!iiCheckTypes(h,t,1)) return TRUE;
1977  if(((intvec*) h->next->Data())->length() != currRing->N &&
1978  ((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
1979  ((intvec*) h->next->next->Data())->length() != currRing->N &&
1980  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) )
1981  {
1982  Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
1983  currRing->N,(currRing->N)*(currRing->N));
1984  return TRUE;
1985  }
1986  ideal arg1 = (ideal) h->Data();
1987  intvec* arg2 = (intvec*) h->next->Data();
1988  intvec* arg3 = (intvec*) h->next->next->Data();
1989  int arg4 = (int)(long) h->next->next->next->Data();
1990  int arg5 = (int)(long) h->next->next->next->next->Data();
1991  int arg6 = (int)(long) h->next->next->next->next->next->Data();
1992  int arg7 = (int)(long) h->next->next->next->next->next->next->Data();
1993  ideal result = (ideal) Mrwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
1994  res->rtyp = IDEAL_CMD;
1995  res->data = result;
1996  return FALSE;
1997  }
1998  else
1999  #endif
2000  /*==================== MAltwalk1 =================*/
2001  #ifdef HAVE_WALK
2002  if (strcmp(sys_cmd, "MAltwalk1") == 0)
2003  {
2004  const short t[]={5,IDEAL_CMD,INT_CMD,INT_CMD,INTVEC_CMD,INTVEC_CMD};
2005  if (!iiCheckTypes(h,t,1)) return TRUE;
2006  if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
2007  ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
2008  {
2009  Werror("system(\"MAltwalk1\" ...) intvecs not of length %d\n",
2010  currRing->N);
2011  return TRUE;
2012  }
2013  ideal arg1 = (ideal) h->Data();
2014  int arg2 = (int) ((long)(h->next->Data()));
2015  int arg3 = (int) ((long)(h->next->next->Data()));
2016  intvec* arg4 = (intvec*) h->next->next->next->Data();
2017  intvec* arg5 = (intvec*) h->next->next->next->next->Data();
2018  ideal result = (ideal) MAltwalk1(arg1, arg2, arg3, arg4, arg5);
2019  res->rtyp = IDEAL_CMD;
2020  res->data = result;
2021  return FALSE;
2022  }
2023  else
2024  #endif
2025  /*==================== MAltwalk1 =================*/
2026  #ifdef HAVE_WALK
2027  #ifdef MFWALK_ALT
2028  if (strcmp(sys_cmd, "Mfwalk_alt") == 0)
2029  {
2030  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
2031  if (!iiCheckTypes(h,t,1)) return TRUE;
2032  if (((intvec*) h->next->Data())->length() != currRing->N &&
2033  ((intvec*) h->next->next->Data())->length() != currRing->N )
2034  {
2035  Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
2036  currRing->N);
2037  return TRUE;
2038  }
2039  ideal arg1 = (ideal) h->Data();
2040  intvec* arg2 = (intvec*) h->next->Data();
2041  intvec* arg3 = (intvec*) h->next->next->Data();
2042  int arg4 = (int) h->next->next->next->Data();
2043  ideal result = (ideal) Mfwalk_alt(arg1, arg2, arg3, arg4);
2044  res->rtyp = IDEAL_CMD;
2045  res->data = result;
2046  return FALSE;
2047  }
2048  else
2049  #endif
2050  #endif
2051  /*==================== Mfwalk =================*/
2052  #ifdef HAVE_WALK
2053  if (strcmp(sys_cmd, "Mfwalk") == 0)
2054  {
2055  const short t[]={5,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD};
2056  if (!iiCheckTypes(h,t,1)) return TRUE;
2057  if (((intvec*) h->next->Data())->length() != currRing->N &&
2058  ((intvec*) h->next->next->Data())->length() != currRing->N )
2059  {
2060  Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
2061  currRing->N);
2062  return TRUE;
2063  }
2064  ideal arg1 = (ideal) h->Data();
2065  intvec* arg2 = (intvec*) h->next->Data();
2066  intvec* arg3 = (intvec*) h->next->next->Data();
2067  int arg4 = (int)(long) h->next->next->next->Data();
2068  int arg5 = (int)(long) h->next->next->next->next->Data();
2069  ideal result = (ideal) Mfwalk(arg1, arg2, arg3, arg4, arg5);
2070  res->rtyp = IDEAL_CMD;
2071  res->data = result;
2072  return FALSE;
2073  }
2074  else
2075  #endif
2076  /*==================== Mfrwalk =================*/
2077  #ifdef HAVE_WALK
2078  if (strcmp(sys_cmd, "Mfrwalk") == 0)
2079  {
2080  const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD};
2081  if (!iiCheckTypes(h,t,1)) return TRUE;
2082 /*
2083  if (((intvec*) h->next->Data())->length() != currRing->N &&
2084  ((intvec*) h->next->next->Data())->length() != currRing->N)
2085  {
2086  Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N);
2087  return TRUE;
2088  }
2089 */
2090  if((((intvec*) h->next->Data())->length() != currRing->N &&
2091  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
2092  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2093  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ))
2094  {
2095  Werror("system(\"Mfrwalk\" ...) intvecs not of length %d or %d\n",
2096  currRing->N,(currRing->N)*(currRing->N));
2097  return TRUE;
2098  }
2099 
2100  ideal arg1 = (ideal) h->Data();
2101  intvec* arg2 = (intvec*) h->next->Data();
2102  intvec* arg3 = (intvec*) h->next->next->Data();
2103  int arg4 = (int)(long) h->next->next->next->Data();
2104  int arg5 = (int)(long) h->next->next->next->next->Data();
2105  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2106  ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2107  res->rtyp = IDEAL_CMD;
2108  res->data = result;
2109  return FALSE;
2110  }
2111  else
2112  /*==================== Mprwalk =================*/
2113  if (strcmp(sys_cmd, "Mprwalk") == 0)
2114  {
2116  if (!iiCheckTypes(h,t,1)) return TRUE;
2117  if((((intvec*) h->next->Data())->length() != currRing->N &&
2118  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
2119  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2120  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ))
2121  {
2122  Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
2123  currRing->N,(currRing->N)*(currRing->N));
2124  return TRUE;
2125  }
2126  ideal arg1 = (ideal) h->Data();
2127  intvec* arg2 = (intvec*) h->next->Data();
2128  intvec* arg3 = (intvec*) h->next->next->Data();
2129  int arg4 = (int)(long) h->next->next->next->Data();
2130  int arg5 = (int)(long) h->next->next->next->next->Data();
2131  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2132  int arg7 = (int)(long) h->next->next->next->next->next->next->Data();
2133  int arg8 = (int)(long) h->next->next->next->next->next->next->next->Data();
2134  int arg9 = (int)(long) h->next->next->next->next->next->next->next->next->Data();
2135  ideal result = (ideal) Mprwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
2136  res->rtyp = IDEAL_CMD;
2137  res->data = result;
2138  return FALSE;
2139  }
2140  else
2141  #endif
2142  /*==================== TranMImprovwalk =================*/
2143  #ifdef HAVE_WALK
2144  #ifdef TRAN_Orig
2145  if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2146  {
2147  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2148  if (!iiCheckTypes(h,t,1)) return TRUE;
2149  if (((intvec*) h->next->Data())->length() != currRing->N &&
2150  ((intvec*) h->next->next->Data())->length() != currRing->N )
2151  {
2152  Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2153  currRing->N);
2154  return TRUE;
2155  }
2156  ideal arg1 = (ideal) h->Data();
2157  intvec* arg2 = (intvec*) h->next->Data();
2158  intvec* arg3 = (intvec*) h->next->next->Data();
2159  ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3);
2160  res->rtyp = IDEAL_CMD;
2161  res->data = result;
2162  return FALSE;
2163  }
2164  else
2165  #endif
2166  #endif
2167  /*==================== MAltwalk2 =================*/
2168  #ifdef HAVE_WALK
2169  if (strcmp(sys_cmd, "MAltwalk2") == 0)
2170  {
2171  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2172  if (!iiCheckTypes(h,t,1)) return TRUE;
2173  if (((intvec*) h->next->Data())->length() != currRing->N &&
2174  ((intvec*) h->next->next->Data())->length() != currRing->N )
2175  {
2176  Werror("system(\"MAltwalk2\" ...) intvecs not of length %d\n",
2177  currRing->N);
2178  return TRUE;
2179  }
2180  ideal arg1 = (ideal) h->Data();
2181  intvec* arg2 = (intvec*) h->next->Data();
2182  intvec* arg3 = (intvec*) h->next->next->Data();
2183  ideal result = (ideal) MAltwalk2(arg1, arg2, arg3);
2184  res->rtyp = IDEAL_CMD;
2185  res->data = result;
2186  return FALSE;
2187  }
2188  else
2189  #endif
2190  /*==================== MAltwalk2 =================*/
2191  #ifdef HAVE_WALK
2192  if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2193  {
2194  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
2195  if (!iiCheckTypes(h,t,1)) return TRUE;
2196  if (((intvec*) h->next->Data())->length() != currRing->N &&
2197  ((intvec*) h->next->next->Data())->length() != currRing->N )
2198  {
2199  Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2200  currRing->N);
2201  return TRUE;
2202  }
2203  ideal arg1 = (ideal) h->Data();
2204  intvec* arg2 = (intvec*) h->next->Data();
2205  intvec* arg3 = (intvec*) h->next->next->Data();
2206  int arg4 = (int) ((long)(h->next->next->next->Data()));
2207  ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3, arg4);
2208  res->rtyp = IDEAL_CMD;
2209  res->data = result;
2210  return FALSE;
2211  }
2212  else
2213  #endif
2214  /*==================== TranMrImprovwalk =================*/
2215  #if 0
2216  #ifdef HAVE_WALK
2217  if (strcmp(sys_cmd, "TranMrImprovwalk") == 0)
2218  {
2219  if (h == NULL || h->Typ() != IDEAL_CMD ||
2220  h->next == NULL || h->next->Typ() != INTVEC_CMD ||
2221  h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
2222  h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD ||
2223  h->next->next->next == NULL || h->next->next->next->next->Typ() != INT_CMD ||
2224  h->next->next->next == NULL || h->next->next->next->next->next->Typ() != INT_CMD)
2225  {
2226  WerrorS("system(\"TranMrImprovwalk\", ideal, intvec, intvec) expected");
2227  return TRUE;
2228  }
2229  if (((intvec*) h->next->Data())->length() != currRing->N &&
2230  ((intvec*) h->next->next->Data())->length() != currRing->N )
2231  {
2232  Werror("system(\"TranMrImprovwalk\" ...) intvecs not of length %d\n", currRing->N);
2233  return TRUE;
2234  }
2235  ideal arg1 = (ideal) h->Data();
2236  intvec* arg2 = (intvec*) h->next->Data();
2237  intvec* arg3 = (intvec*) h->next->next->Data();
2238  int arg4 = (int)(long) h->next->next->next->Data();
2239  int arg5 = (int)(long) h->next->next->next->next->Data();
2240  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2241  ideal result = (ideal) TranMrImprovwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2242  res->rtyp = IDEAL_CMD;
2243  res->data = result;
2244  return FALSE;
2245  }
2246  else
2247  #endif
2248  #endif
2249  /*================= Extended system call ========================*/
2250  {
2251  #ifndef MAKE_DISTRIBUTION
2252  return(jjEXTENDED_SYSTEM(res, args));
2253  #else
2254  Werror( "system(\"%s\",...) %s", sys_cmd, feNotImplemented );
2255  #endif
2256  }
2257  } /* typ==string */
2258  return TRUE;
2259 }
2260 
2261 
2262 #ifdef HAVE_EXTENDED_SYSTEM
2263  // You can put your own system calls here
2264 # include "kernel/fglm/fglm.h"
2265 # ifdef HAVE_NEWTON
2266 # include "hc_newton.h"
2267 # endif
2268 # include "polys/mod_raw.h"
2269 # include "polys/monomials/ring.h"
2270 # include "kernel/GBEngine/shiftgb.h"
2271 # include "kernel/GBEngine/kutil.h"
2272 
2274 {
2275  if(h->Typ() == STRING_CMD)
2276  {
2277  char *sys_cmd=(char *)(h->Data());
2278  h=h->next;
2279  /*==================== test syz strat =================*/
2280  if (strcmp(sys_cmd, "syz") == 0)
2281  {
2282  if ((h!=NULL) && (h->Typ()==STRING_CMD))
2283  {
2284  const char *s=(const char *)h->Data();
2285  if (strcmp(s,"posInT_EcartFDegpLength")==0)
2287  else if (strcmp(s,"posInT_FDegpLength")==0)
2289  else if (strcmp(s,"posInT_pLength")==0)
2291  else if (strcmp(s,"posInT0")==0)
2293  else if (strcmp(s,"posInT1")==0)
2295  else if (strcmp(s,"posInT2")==0)
2297  else if (strcmp(s,"posInT11")==0)
2299  else if (strcmp(s,"posInT110")==0)
2301  else if (strcmp(s,"posInT13")==0)
2303  else if (strcmp(s,"posInT15")==0)
2305  else if (strcmp(s,"posInT17")==0)
2307  else if (strcmp(s,"posInT17_c")==0)
2309  else if (strcmp(s,"posInT19")==0)
2311  else PrintS("valid posInT:0,1,2,11,110,13,15,17,17_c,19,_EcartFDegpLength,_FDegpLength,_pLength,_EcartpLength\n");
2312  }
2313  else
2314  {
2315  test_PosInT=NULL;
2316  test_PosInL=NULL;
2317  }
2318  si_opt_2|=Sy_bit(23);
2319  return FALSE;
2320  }
2321  else
2322  /*==================== locNF ======================================*/
2323  if(strcmp(sys_cmd,"locNF")==0)
2324  {
2325  const short t[]={4,VECTOR_CMD,MODUL_CMD,INT_CMD,INTVEC_CMD};
2326  if (iiCheckTypes(h,t,1))
2327  {
2328  poly f=(poly)h->Data();
2329  h=h->next;
2330  ideal m=(ideal)h->Data();
2331  assumeStdFlag(h);
2332  h=h->next;
2333  int n=(int)((long)h->Data());
2334  h=h->next;
2335  intvec *v=(intvec *)h->Data();
2336 
2337  /* == now the work starts == */
2338 
2339  int * iv=iv2array(v, currRing);
2340  poly r=0;
2341  poly hp=ppJetW(f,n,iv);
2342  int s=MATCOLS(m);
2343  int j=0;
2344  matrix T=mp_InitI(s,1,0, currRing);
2345 
2346  while (hp != NULL)
2347  {
2348  if (pDivisibleBy(m->m[j],hp))
2349  {
2350  if (MATELEM(T,j+1,1)==0)
2351  {
2352  MATELEM(T,j+1,1)=pDivideM(pHead(hp),pHead(m->m[j]));
2353  }
2354  else
2355  {
2356  pAdd(MATELEM(T,j+1,1),pDivideM(pHead(hp),pHead(m->m[j])));
2357  }
2358  hp=ppJetW(ksOldSpolyRed(m->m[j],hp,0),n,iv);
2359  j=0;
2360  }
2361  else
2362  {
2363  if (j==s-1)
2364  {
2365  r=pAdd(r,pHead(hp));
2366  hp=pLmDeleteAndNext(hp); /* hp=pSub(hp,pHead(hp));*/
2367  j=0;
2368  }
2369  else
2370  {
2371  j++;
2372  }
2373  }
2374  }
2375 
2378  for (int k=1;k<=MATROWS(Temp);k++)
2379  {
2380  MATELEM(R,k,1)=MATELEM(Temp,k,1);
2381  }
2382 
2384  L->Init(2);
2385  L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)R;
2386  L->m[1].rtyp=MATRIX_CMD; L->m[1].data=(void *)T;
2387  res->data=L;
2388  res->rtyp=LIST_CMD;
2389  // iv aufraeumen
2390  omFree(iv);
2391  return FALSE;
2392  }
2393  else
2394  return TRUE;
2395  }
2396  else
2397  /*==================== poly debug ==================================*/
2398  if(strcmp(sys_cmd,"p")==0)
2399  {
2400 # ifdef RDEBUG
2401  p_DebugPrint((poly)h->Data(), currRing);
2402 # else
2403  WarnS("Sorry: not available for release build!");
2404 # endif
2405  return FALSE;
2406  }
2407  else
2408  /*==================== setsyzcomp ==================================*/
2409  if(strcmp(sys_cmd,"setsyzcomp")==0)
2410  {
2411  if ((h!=NULL) && (h->Typ()==INT_CMD))
2412  {
2413  int k = (int)(long)h->Data();
2414  if ( currRing->order[0] == ringorder_s )
2415  {
2417  }
2418  }
2419  }
2420  /*==================== ring debug ==================================*/
2421  if(strcmp(sys_cmd,"r")==0)
2422  {
2423 # ifdef RDEBUG
2424  rDebugPrint((ring)h->Data());
2425 # else
2426  WarnS("Sorry: not available for release build!");
2427 # endif
2428  return FALSE;
2429  }
2430  else
2431  /*==================== changeRing ========================*/
2432  /* The following code changes the names of the variables in the
2433  current ring to "x1", "x2", ..., "xN", where N is the number
2434  of variables in the current ring.
2435  The purpose of this rewriting is to eliminate indexed variables,
2436  as they may cause problems when generating scripts for Magma,
2437  Maple, or Macaulay2. */
2438  if(strcmp(sys_cmd,"changeRing")==0)
2439  {
2440  int varN = currRing->N;
2441  char h[12];
2442  for (int i = 1; i <= varN; i++)
2443  {
2444  omFree(currRing->names[i - 1]);
2445  sprintf(h, "x%d", i);
2446  currRing->names[i - 1] = omStrDup(h);
2447  }
2449  res->rtyp = INT_CMD;
2450  res->data = (void*)0L;
2451  return FALSE;
2452  }
2453  else
2454  /*==================== mtrack ==================================*/
2455  if(strcmp(sys_cmd,"mtrack")==0)
2456  {
2457  #ifdef OM_TRACK
2458  om_Opts.MarkAsStatic = 1;
2459  FILE *fd = NULL;
2460  int max = 5;
2461  while (h != NULL)
2462  {
2464  if (fd == NULL && h->Typ()==STRING_CMD)
2465  {
2466  char *fn=(char*) h->Data();
2467  fd = fopen(fn, "w");
2468  if (fd == NULL)
2469  Warn("Can not open %s for writing og mtrack. Using stdout",fn);
2470  }
2471  else if (h->Typ() == INT_CMD)
2472  {
2473  max = (int)(long)h->Data();
2474  }
2475  h = h->Next();
2476  }
2477  omPrintUsedTrackAddrs((fd == NULL ? stdout : fd), max);
2478  if (fd != NULL) fclose(fd);
2479  om_Opts.MarkAsStatic = 0;
2480  return FALSE;
2481  #else
2482  WerrorS("system(\"mtrack\",..) is not implemented in this version");
2483  return TRUE;
2484  #endif
2485  }
2486  else
2487  /*==================== backtrace ==================================*/
2488  #ifndef OM_NDEBUG
2489  if(strcmp(sys_cmd,"backtrace")==0)
2490  {
2491  omPrintCurrentBackTrace(stdout);
2492  return FALSE;
2493  }
2494  else
2495  #endif
2496 
2497 #if !defined(OM_NDEBUG)
2498  /*==================== omMemoryTest ==================================*/
2499  if (strcmp(sys_cmd,"omMemoryTest")==0)
2500  {
2501 
2502 #ifdef OM_STATS_H
2503  PrintS("\n[om_Info]: \n");
2504  omUpdateInfo();
2505 #define OM_PRINT(name) Print(" %-22s : %10ld \n", #name, om_Info . name)
2506  OM_PRINT(MaxBytesSystem);
2507  OM_PRINT(CurrentBytesSystem);
2508  OM_PRINT(MaxBytesSbrk);
2509  OM_PRINT(CurrentBytesSbrk);
2510  OM_PRINT(MaxBytesMmap);
2511  OM_PRINT(CurrentBytesMmap);
2512  OM_PRINT(UsedBytes);
2513  OM_PRINT(AvailBytes);
2514  OM_PRINT(UsedBytesMalloc);
2515  OM_PRINT(AvailBytesMalloc);
2516  OM_PRINT(MaxBytesFromMalloc);
2517  OM_PRINT(CurrentBytesFromMalloc);
2518  OM_PRINT(MaxBytesFromValloc);
2519  OM_PRINT(CurrentBytesFromValloc);
2520  OM_PRINT(UsedBytesFromValloc);
2521  OM_PRINT(AvailBytesFromValloc);
2522  OM_PRINT(MaxPages);
2523  OM_PRINT(UsedPages);
2524  OM_PRINT(AvailPages);
2525  OM_PRINT(MaxRegionsAlloc);
2526  OM_PRINT(CurrentRegionsAlloc);
2527 #undef OM_PRINT
2528 #endif
2529 
2530 #ifdef OM_OPTS_H
2531  PrintS("\n[om_Opts]: \n");
2532 #define OM_PRINT(format, name) Print(" %-22s : %10" format"\n", #name, om_Opts . name)
2533  OM_PRINT("d", MinTrack);
2534  OM_PRINT("d", MinCheck);
2535  OM_PRINT("d", MaxTrack);
2536  OM_PRINT("d", MaxCheck);
2537  OM_PRINT("d", Keep);
2538  OM_PRINT("d", HowToReportErrors);
2539  OM_PRINT("d", MarkAsStatic);
2540  OM_PRINT("u", PagesPerRegion);
2541  OM_PRINT("p", OutOfMemoryFunc);
2542  OM_PRINT("p", MemoryLowFunc);
2543  OM_PRINT("p", ErrorHook);
2544 #undef OM_PRINT
2545 #endif
2546 
2547 #ifdef OM_ERROR_H
2548  Print("\n\n[om_ErrorStatus] : '%s' (%s)\n",
2551  Print("[om_InternalErrorStatus]: '%s' (%s)\n",
2554 
2555 #endif
2556 
2557 // omTestMemory(1);
2558 // omtTestErrors();
2559  return FALSE;
2560  }
2561  else
2562 #endif
2563  /*==================== pDivStat =============================*/
2564  #if defined(PDEBUG) || defined(PDIV_DEBUG)
2565  if(strcmp(sys_cmd,"pDivStat")==0)
2566  {
2567  extern void pPrintDivisbleByStat();
2569  return FALSE;
2570  }
2571  else
2572  #endif
2573  /*==================== red =============================*/
2574  #if 0
2575  if(strcmp(sys_cmd,"red")==0)
2576  {
2577  if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2578  {
2579  res->rtyp=IDEAL_CMD;
2580  res->data=(void *)kStdred((ideal)h->Data(),NULL,testHomog,NULL);
2581  setFlag(res,FLAG_STD);
2582  return FALSE;
2583  }
2584  else
2585  WerrorS("ideal expected");
2586  }
2587  else
2588  #endif
2589  /*==================== fastcomb =============================*/
2590  if(strcmp(sys_cmd,"fastcomb")==0)
2591  {
2592  if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2593  {
2594  if (h->next!=NULL)
2595  {
2596  if (h->next->Typ()!=POLY_CMD)
2597  {
2598  WarnS("Wrong types for poly= comb(ideal,poly)");
2599  }
2600  }
2601  res->rtyp=POLY_CMD;
2602  res->data=(void *) fglmLinearCombination(
2603  (ideal)h->Data(),(poly)h->next->Data());
2604  return FALSE;
2605  }
2606  else
2607  WerrorS("ideal expected");
2608  }
2609  else
2610  /*==================== comb =============================*/
2611  if(strcmp(sys_cmd,"comb")==0)
2612  {
2613  if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
2614  {
2615  if (h->next!=NULL)
2616  {
2617  if (h->next->Typ()!=POLY_CMD)
2618  {
2619  WarnS("Wrong types for poly= comb(ideal,poly)");
2620  }
2621  }
2622  res->rtyp=POLY_CMD;
2623  res->data=(void *)fglmNewLinearCombination(
2624  (ideal)h->Data(),(poly)h->next->Data());
2625  return FALSE;
2626  }
2627  else
2628  WerrorS("ideal expected");
2629  }
2630  else
2631  #if 0 /* debug only */
2632  /*==================== listall ===================================*/
2633  if(strcmp(sys_cmd,"listall")==0)
2634  {
2635  void listall(int showproc);
2636  int showproc=0;
2637  if ((h!=NULL) && (h->Typ()==INT_CMD)) showproc=(int)((long)h->Data());
2638  listall(showproc);
2639  return FALSE;
2640  }
2641  else
2642  #endif
2643  #if 0 /* debug only */
2644  /*==================== proclist =================================*/
2645  if(strcmp(sys_cmd,"proclist")==0)
2646  {
2647  void piShowProcList();
2648  piShowProcList();
2649  return FALSE;
2650  }
2651  else
2652  #endif
2653  /* ==================== newton ================================*/
2654  #ifdef HAVE_NEWTON
2655  if(strcmp(sys_cmd,"newton")==0)
2656  {
2657  if ((h->Typ()!=POLY_CMD)
2658  || (h->next->Typ()!=INT_CMD)
2659  || (h->next->next->Typ()!=INT_CMD))
2660  {
2661  WerrorS("system(\"newton\",<poly>,<int>,<int>) expected");
2662  return TRUE;
2663  }
2664  poly p=(poly)(h->Data());
2665  int l=pLength(p);
2666  short *points=(short *)omAlloc(currRing->N*l*sizeof(short));
2667  int i,j,k;
2668  k=0;
2669  poly pp=p;
2670  for (i=0;pp!=NULL;i++)
2671  {
2672  for(j=1;j<=currRing->N;j++)
2673  {
2674  points[k]=pGetExp(pp,j);
2675  k++;
2676  }
2677  pIter(pp);
2678  }
2679  hc_ERG r=hc_KOENIG(currRing->N, // dimension
2680  l, // number of points
2681  (short*) points, // points: x_1, y_1,z_1, x_2,y_2,z2,...
2682  currRing->OrdSgn==-1,
2683  (int) (h->next->Data()), // 1: Milnor, 0: Newton
2684  (int) (h->next->next->Data()) // debug
2685  );
2686  //----<>---Output-----------------------
2687 
2688 
2689  // PrintS("Bin jetzt in extra.cc bei der Auswertung.\n"); // **********
2690 
2691 
2693  L->Init(6);
2694  L->m[0].rtyp=STRING_CMD; // newtonnumber;
2695  L->m[0].data=(void *)omStrDup(r.nZahl);
2696  L->m[1].rtyp=INT_CMD;
2697  L->m[1].data=(void *)(long)r.achse; // flag for unoccupied axes
2698  L->m[2].rtyp=INT_CMD;
2699  L->m[2].data=(void *)(long)r.deg; // #degenerations
2700  if ( r.deg != 0) // only if degenerations exist
2701  {
2702  L->m[3].rtyp=INT_CMD;
2703  L->m[3].data=(void *)(long)r.anz_punkte; // #points
2704  //---<>--number of points------
2705  int anz = r.anz_punkte; // number of points
2706  int dim = (currRing->N); // dimension
2707  intvec* v = new intvec( anz*dim );
2708  for (i=0; i<anz*dim; i++) // copy points
2709  (*v)[i] = r.pu[i];
2710  L->m[4].rtyp=INTVEC_CMD;
2711  L->m[4].data=(void *)v;
2712  //---<>--degenerations---------
2713  int deg = r.deg; // number of points
2714  intvec* w = new intvec( r.speicher ); // necessary memory
2715  i=0; // start copying
2716  do
2717  {
2718  (*w)[i] = r.deg_tab[i];
2719  i++;
2720  }
2721  while (r.deg_tab[i-1] != -2); // mark for end of list
2722  L->m[5].rtyp=INTVEC_CMD;
2723  L->m[5].data=(void *)w;
2724  }
2725  else
2726  {
2727  L->m[3].rtyp=INT_CMD; L->m[3].data=(char *)0;
2728  L->m[4].rtyp=DEF_CMD;
2729  L->m[5].rtyp=DEF_CMD;
2730  }
2731 
2732  res->data=(void *)L;
2733  res->rtyp=LIST_CMD;
2734  // free all pointer in r:
2735  delete[] r.nZahl;
2736  delete[] r.pu;
2737  delete[] r.deg_tab; // Ist das ein Problem??
2738 
2739  omFreeSize((ADDRESS)points,currRing->N*l*sizeof(short));
2740  return FALSE;
2741  }
2742  else
2743  #endif
2744  /*==== connection to Sebastian Jambor's code ======*/
2745  /* This code connects Sebastian Jambor's code for
2746  computing the minimal polynomial of an (n x n) matrix
2747  with entries in F_p to SINGULAR. Two conversion methods
2748  are needed; see further up in this file:
2749  (1) conversion of a matrix with long entries to
2750  a SINGULAR matrix with number entries, where
2751  the numbers are coefficients in currRing;
2752  (2) conversion of an array of longs (encoding the
2753  coefficients of the minimal polynomial) to a
2754  SINGULAR poly living in currRing. */
2755  if (strcmp(sys_cmd, "minpoly") == 0)
2756  {
2757  if ((h == NULL) || (h->Typ() != MATRIX_CMD) || h->next != NULL)
2758  {
2759  Werror("expected exactly one argument: %s",
2760  "a square matrix with number entries");
2761  return TRUE;
2762  }
2763  else
2764  {
2765  matrix m = (matrix)h->Data();
2766  int n = m->rows();
2767  unsigned long p = (unsigned long)n_GetChar(currRing->cf);
2768  if (n != m->cols())
2769  {
2770  WerrorS("expected exactly one argument: "
2771  "a square matrix with number entries");
2772  return TRUE;
2773  }
2774  unsigned long** ml = singularMatrixToLongMatrix(m);
2775  unsigned long* polyCoeffs = computeMinimalPolynomial(ml, n, p);
2776  poly theMinPoly = longCoeffsToSingularPoly(polyCoeffs, n);
2777  res->rtyp = POLY_CMD;
2778  res->data = (void *)theMinPoly;
2779  for (int i = 0; i < n; i++) delete[] ml[i];
2780  delete[] ml;
2781  delete[] polyCoeffs;
2782  return FALSE;
2783  }
2784  }
2785  else
2786  /*==================== sdb_flags =================*/
2787  #ifdef HAVE_SDB
2788  if (strcmp(sys_cmd, "sdb_flags") == 0)
2789  {
2790  if ((h!=NULL) && (h->Typ()==INT_CMD))
2791  {
2792  sdb_flags=(int)((long)h->Data());
2793  }
2794  else
2795  {
2796  WerrorS("system(\"sdb_flags\",`int`) expected");
2797  return TRUE;
2798  }
2799  return FALSE;
2800  }
2801  else
2802  #endif
2803  /*==================== sdb_edit =================*/
2804  #ifdef HAVE_SDB
2805  if (strcmp(sys_cmd, "sdb_edit") == 0)
2806  {
2807  if ((h!=NULL) && (h->Typ()==PROC_CMD))
2808  {
2809  procinfov p=(procinfov)h->Data();
2810  sdb_edit(p);
2811  }
2812  else
2813  {
2814  WerrorS("system(\"sdb_edit\",`proc`) expected");
2815  return TRUE;
2816  }
2817  return FALSE;
2818  }
2819  else
2820  #endif
2821  /*==================== GF =================*/
2822  #if 0 // for testing only
2823  if (strcmp(sys_cmd, "GF") == 0)
2824  {
2825  if ((h!=NULL) && (h->Typ()==POLY_CMD))
2826  {
2827  int c=rChar(currRing);
2828  setCharacteristic( c,nfMinPoly[0], currRing->parameter[0][0] );
2829  CanonicalForm F( convSingGFFactoryGF( (poly)h->Data(), currRing ) );
2830  res->rtyp=POLY_CMD;
2831  res->data=convFactoryGFSingGF( F, currRing );
2832  return FALSE;
2833  }
2834  else { WerrorS("wrong typ"); return TRUE;}
2835  }
2836  else
2837  #endif
2838  /*==================== SVD =================*/
2839  #ifdef HAVE_SVD
2840  if (strcmp(sys_cmd, "svd") == 0)
2841  {
2842  extern lists testsvd(matrix M);
2843  res->rtyp=LIST_CMD;
2844  res->data=(char*)(testsvd((matrix)h->Data()));
2845  return FALSE;
2846  }
2847  else
2848  #endif
2849 
2850 
2851  /*==================== DLL =================*/
2852  #ifdef __CYGWIN__
2853  #ifdef HAVE_DL
2854  /* testing the DLL functionality under Win32 */
2855  if (strcmp(sys_cmd, "DLL") == 0)
2856  {
2857  typedef void (*Void_Func)();
2858  typedef int (*Int_Func)(int);
2859  void *hh=dynl_open("WinDllTest.dll");
2860  if ((h!=NULL) && (h->Typ()==INT_CMD))
2861  {
2862  int (*f)(int);
2863  if (hh!=NULL)
2864  {
2865  int (*f)(int);
2866  f=(Int_Func)dynl_sym(hh,"PlusDll");
2867  int i=10;
2868  if (f!=NULL) printf("%d\n",f(i));
2869  else PrintS("cannot find PlusDll\n");
2870  }
2871  }
2872  else
2873  {
2874  void (*f)();
2875  f= (Void_Func)dynl_sym(hh,"TestDll");
2876  if (f!=NULL) f();
2877  else PrintS("cannot find TestDll\n");
2878  }
2879  return FALSE;
2880  }
2881  else
2882  #endif
2883  #endif
2884  #ifdef HAVE_RING2TOM
2885  /*==================== ring-GB ==================================*/
2886  if (strcmp(sys_cmd, "findZeroPoly")==0)
2887  {
2888  ring r = currRing;
2889  poly f = (poly) h->Data();
2890  res->rtyp=POLY_CMD;
2891  res->data=(poly) kFindZeroPoly(f, r, r);
2892  return(FALSE);
2893  }
2894  else
2895  /*==================== Creating zero polynomials =================*/
2896  #ifdef HAVE_VANIDEAL
2897  if (strcmp(sys_cmd, "createG0")==0)
2898  {
2899  /* long exp[50];
2900  int N = 0;
2901  while (h != NULL)
2902  {
2903  N += 1;
2904  exp[N] = (long) h->Data();
2905  // if (exp[i] % 2 != 0) exp[i] -= 1;
2906  h = h->next;
2907  }
2908  for (int k = 1; N + k <= currRing->N; k++) exp[k] = 0;
2909 
2910  poly t_p;
2911  res->rtyp=POLY_CMD;
2912  res->data= (poly) kCreateZeroPoly(exp, -1, &t_p, currRing, currRing);
2913  return(FALSE); */
2914 
2915  res->rtyp = IDEAL_CMD;
2916  res->data = (ideal) createG0();
2917  return(FALSE);
2918  }
2919  else
2920  #endif
2921  /*==================== redNF_ring =================*/
2922  if (strcmp(sys_cmd, "redNF_ring")==0)
2923  {
2924  ring r = currRing;
2925  poly f = (poly) h->Data();
2926  h = h->next;
2927  ideal G = (ideal) h->Data();
2928  res->rtyp=POLY_CMD;
2929  res->data=(poly) ringRedNF(f, G, r);
2930  return(FALSE);
2931  }
2932  else
2933  #endif
2934  /*==================== Roune Hilb =================*/
2935  if (strcmp(sys_cmd, "hilbroune") == 0)
2936  {
2937  if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
2938  {
2939  slicehilb((ideal)h->Data());
2940  }
2941  else return TRUE;
2942  return FALSE;
2943  }
2944  else
2945  /*==================== F5 Implementation =================*/
2946  #ifdef HAVE_F5
2947  if (strcmp(sys_cmd, "f5")==0)
2948  {
2949  if (h->Typ()!=IDEAL_CMD)
2950  {
2951  WerrorS("ideal expected");
2952  return TRUE;
2953  }
2954 
2955  ring r = currRing;
2956  ideal G = (ideal) h->Data();
2957  h = h->next;
2958  int opt;
2959  if(h != NULL) {
2960  opt = (int) (long) h->Data();
2961  }
2962  else {
2963  opt = 2;
2964  }
2965  h = h->next;
2966  int plus;
2967  if(h != NULL) {
2968  plus = (int) (long) h->Data();
2969  }
2970  else {
2971  plus = 0;
2972  }
2973  h = h->next;
2974  int termination;
2975  if(h != NULL) {
2976  termination = (int) (long) h->Data();
2977  }
2978  else {
2979  termination = 0;
2980  }
2981  res->rtyp=IDEAL_CMD;
2982  res->data=(ideal) F5main(G,r,opt,plus,termination);
2983  return FALSE;
2984  }
2985  else
2986  #endif
2987  /*==================== Testing groebner basis =================*/
2988  #ifdef HAVE_RINGS
2989  if (strcmp(sys_cmd, "NF_ring")==0)
2990  {
2991  ring r = currRing;
2992  poly f = (poly) h->Data();
2993  h = h->next;
2994  ideal G = (ideal) h->Data();
2995  res->rtyp=POLY_CMD;
2996  res->data=(poly) ringNF(f, G, r);
2997  return(FALSE);
2998  }
2999  else
3000  if (strcmp(sys_cmd, "spoly")==0)
3001  {
3002  poly f = pCopy((poly) h->Data());
3003  h = h->next;
3004  poly g = pCopy((poly) h->Data());
3005 
3006  res->rtyp=POLY_CMD;
3007  res->data=(poly) plain_spoly(f,g);
3008  return(FALSE);
3009  }
3010  else
3011  if (strcmp(sys_cmd, "testGB")==0)
3012  {
3013  ideal I = (ideal) h->Data();
3014  h = h->next;
3015  ideal GI = (ideal) h->Data();
3016  res->rtyp = INT_CMD;
3017  res->data = (void *)(long) testGB(I, GI);
3018  return(FALSE);
3019  }
3020  else
3021  #endif
3022  /*==================== sca:AltVar ==================================*/
3023  #ifdef HAVE_PLURAL
3024  if ( (strcmp(sys_cmd, "AltVarStart") == 0) || (strcmp(sys_cmd, "AltVarEnd") == 0) )
3025  {
3026  ring r = currRing;
3027 
3028  if((h!=NULL) && (h->Typ()==RING_CMD)) r = (ring)h->Data(); else
3029  {
3030  WerrorS("`system(\"AltVarStart/End\"[,<ring>])` expected");
3031  return TRUE;
3032  }
3033 
3034  res->rtyp=INT_CMD;
3035 
3036  if (rIsSCA(r))
3037  {
3038  if(strcmp(sys_cmd, "AltVarStart") == 0)
3039  res->data = (void*)(long)scaFirstAltVar(r);
3040  else
3041  res->data = (void*)(long)scaLastAltVar(r);
3042  return FALSE;
3043  }
3044 
3045  WerrorS("`system(\"AltVarStart/End\",<ring>) requires a SCA ring");
3046  return TRUE;
3047  }
3048  else
3049  #endif
3050  /*==================== RatNF, noncomm rational coeffs =================*/
3051  #ifdef HAVE_RATGRING
3052  if (strcmp(sys_cmd, "intratNF") == 0)
3053  {
3054  poly p;
3055  poly *q;
3056  ideal I;
3057  int is, k, id;
3058  if ((h!=NULL) && (h->Typ()==POLY_CMD))
3059  {
3060  p=(poly)h->CopyD();
3061  h=h->next;
3062  // PrintS("poly is done\n");
3063  }
3064  else return TRUE;
3065  if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
3066  {
3067  I=(ideal)h->CopyD();
3068  q = I->m;
3069  h=h->next;
3070  // PrintS("ideal is done\n");
3071  }
3072  else return TRUE;
3073  if ((h!=NULL) && (h->Typ()==INT_CMD))
3074  {
3075  is=(int)((long)(h->Data()));
3076  // res->rtyp=INT_CMD;
3077  // PrintS("int is done\n");
3078  // res->rtyp=IDEAL_CMD;
3079  if (rIsPluralRing(currRing))
3080  {
3081  id = IDELEMS(I);
3082  int *pl=(int*)omAlloc0(IDELEMS(I)*sizeof(int));
3083  for(k=0; k < id; k++)
3084  {
3085  pl[k] = pLength(I->m[k]);
3086  }
3087  PrintS("starting redRat\n");
3088  //res->data = (char *)
3089  redRat(&p, q, pl, (int)IDELEMS(I),is,currRing);
3090  res->data=p;
3091  res->rtyp=POLY_CMD;
3092  // res->data = ncGCD(p,q,currRing);
3093  }
3094  else
3095  {
3096  res->rtyp=POLY_CMD;
3097  res->data=p;
3098  }
3099  }
3100  else return TRUE;
3101  return FALSE;
3102  }
3103  else
3104  /*==================== RatNF, noncomm rational coeffs =================*/
3105  if (strcmp(sys_cmd, "ratNF") == 0)
3106  {
3107  poly p,q;
3108  int is, htype;
3109  if ((h!=NULL) && ( (h->Typ()==POLY_CMD) || (h->Typ()==VECTOR_CMD) ) )
3110  {
3111  p=(poly)h->CopyD();
3112  h=h->next;
3113  htype = h->Typ();
3114  }
3115  else return TRUE;
3116  if ((h!=NULL) && ( (h->Typ()==POLY_CMD) || (h->Typ()==VECTOR_CMD) ) )
3117  {
3118  q=(poly)h->CopyD();
3119  h=h->next;
3120  }
3121  else return TRUE;
3122  if ((h!=NULL) && (h->Typ()==INT_CMD))
3123  {
3124  is=(int)((long)(h->Data()));
3125  res->rtyp=htype;
3126  // res->rtyp=IDEAL_CMD;
3127  if (rIsPluralRing(currRing))
3128  {
3129  res->data = nc_rat_ReduceSpolyNew(q,p,is, currRing);
3130  // res->data = ncGCD(p,q,currRing);
3131  }
3132  else res->data=p;
3133  }
3134  else return TRUE;
3135  return FALSE;
3136  }
3137  else
3138  /*==================== RatSpoly, noncomm rational coeffs =================*/
3139  if (strcmp(sys_cmd, "ratSpoly") == 0)
3140  {
3141  poly p,q;
3142  int is;
3143  if ((h!=NULL) && (h->Typ()==POLY_CMD))
3144  {
3145  p=(poly)h->CopyD();
3146  h=h->next;
3147  }
3148  else return TRUE;
3149  if ((h!=NULL) && (h->Typ()==POLY_CMD))
3150  {
3151  q=(poly)h->CopyD();
3152  h=h->next;
3153  }
3154  else return TRUE;
3155  if ((h!=NULL) && (h->Typ()==INT_CMD))
3156  {
3157  is=(int)((long)(h->Data()));
3158  res->rtyp=POLY_CMD;
3159  // res->rtyp=IDEAL_CMD;
3160  if (rIsPluralRing(currRing))
3161  {
3162  res->data = nc_rat_CreateSpoly(p,q,is,currRing);
3163  // res->data = ncGCD(p,q,currRing);
3164  }
3165  else res->data=p;
3166  }
3167  else return TRUE;
3168  return FALSE;
3169  }
3170  else
3171  #endif // HAVE_RATGRING
3172  /*==================== Rat def =================*/
3173  if (strcmp(sys_cmd, "ratVar") == 0)
3174  {
3175  int start,end;
3176  if ((h!=NULL) && (h->Typ()==POLY_CMD))
3177  {
3178  start=pIsPurePower((poly)h->Data());
3179  h=h->next;
3180  }
3181  else return TRUE;
3182  if ((h!=NULL) && (h->Typ()==POLY_CMD))
3183  {
3184  end=pIsPurePower((poly)h->Data());
3185  h=h->next;
3186  }
3187  else return TRUE;
3188  currRing->real_var_start=start;
3189  currRing->real_var_end=end;
3190  return (start==0)||(end==0)||(start>end);
3191  }
3192  else
3193  /*==================== t-rep-GB ==================================*/
3194  if (strcmp(sys_cmd, "unifastmult")==0)
3195  {
3196  poly f = (poly)h->Data();
3197  h=h->next;
3198  poly g=(poly)h->Data();
3199  res->rtyp=POLY_CMD;
3200  res->data=unifastmult(f,g,currRing);
3201  return(FALSE);
3202  }
3203  else
3204  if (strcmp(sys_cmd, "multifastmult")==0)
3205  {
3206  poly f = (poly)h->Data();
3207  h=h->next;
3208  poly g=(poly)h->Data();
3209  res->rtyp=POLY_CMD;
3210  res->data=multifastmult(f,g,currRing);
3211  return(FALSE);
3212  }
3213  else
3214  if (strcmp(sys_cmd, "mults")==0)
3215  {
3216  res->rtyp=INT_CMD ;
3217  res->data=(void*)(long) Mults();
3218  return(FALSE);
3219  }
3220  else
3221  if (strcmp(sys_cmd, "fastpower")==0)
3222  {
3223  ring r = currRing;
3224  poly f = (poly)h->Data();
3225  h=h->next;
3226  int n=(int)((long)h->Data());
3227  res->rtyp=POLY_CMD ;
3228  res->data=(void*) pFastPower(f,n,r);
3229  return(FALSE);
3230  }
3231  else
3232  if (strcmp(sys_cmd, "normalpower")==0)
3233  {
3234  poly f = (poly)h->Data();
3235  h=h->next;
3236  int n=(int)((long)h->Data());
3237  res->rtyp=POLY_CMD ;
3238  res->data=(void*) pPower(pCopy(f),n);
3239  return(FALSE);
3240  }
3241  else
3242  if (strcmp(sys_cmd, "MCpower")==0)
3243  {
3244  ring r = currRing;
3245  poly f = (poly)h->Data();
3246  h=h->next;
3247  int n=(int)((long)h->Data());
3248  res->rtyp=POLY_CMD ;
3249  res->data=(void*) pFastPowerMC(f,n,r);
3250  return(FALSE);
3251  }
3252  else
3253  if (strcmp(sys_cmd, "bit_subst")==0)
3254  {
3255  ring r = currRing;
3256  poly outer = (poly)h->Data();
3257  h=h->next;
3258  poly inner=(poly)h->Data();
3259  res->rtyp=POLY_CMD ;
3260  res->data=(void*) uni_subst_bits(outer, inner,r);
3261  return(FALSE);
3262  }
3263  else
3264  /*==================== gcd-varianten =================*/
3265  if (strcmp(sys_cmd, "gcd") == 0)
3266  {
3267  if (h==NULL)
3268  {
3269  #if 0
3270  Print("FLINT_P:%d (use Flints gcd for polynomials in char p)\n",isOn(SW_USE_FL_GCD_P));
3271  Print("FLINT_0:%d (use Flints gcd for polynomials in char 0)\n",isOn(SW_USE_FL_GCD_0));
3272  #endif
3273  Print("EZGCD:%d (use EZGCD for gcd of polynomials in char 0)\n",isOn(SW_USE_EZGCD));
3274  Print("EZGCD_P:%d (use EZGCD_P for gcd of polynomials in char p)\n",isOn(SW_USE_EZGCD_P));
3275  Print("CRGCD:%d (use chinese Remainder for gcd of polynomials in char 0)\n",isOn(SW_USE_CHINREM_GCD));
3276  #ifndef __CYGWIN__
3277  Print("homog:%d (use homog. test for factorization of polynomials)\n",singular_homog_flag);
3278  #endif
3279  return FALSE;
3280  }
3281  else
3282  if ((h!=NULL) && (h->Typ()==STRING_CMD)
3283  && (h->next!=NULL) && (h->next->Typ()==INT_CMD))
3284  {
3285  int d=(int)(long)h->next->Data();
3286  char *s=(char *)h->Data();
3287  #if 0
3288  if (strcmp(s,"FLINT_P")==0) { if (d) On(SW_USE_FL_GCD_P); else Off(SW_USE_FL_GCD_P); } else
3289  if (strcmp(s,"FLINT_0")==0) { if (d) On(SW_USE_FL_GCD_0); else Off(SW_USE_FL_GCD_0); } else
3290  #endif
3291  if (strcmp(s,"EZGCD")==0) { if (d) On(SW_USE_EZGCD); else Off(SW_USE_EZGCD); } else
3292  if (strcmp(s,"EZGCD_P")==0) { if (d) On(SW_USE_EZGCD_P); else Off(SW_USE_EZGCD_P); } else
3293  if (strcmp(s,"CRGCD")==0) { if (d) On(SW_USE_CHINREM_GCD); else Off(SW_USE_CHINREM_GCD); } else
3294  #ifndef __CYGWIN__
3295  if (strcmp(s,"homog")==0) { if (d) singular_homog_flag=1; else singular_homog_flag=0; } else
3296  #endif
3297  return TRUE;
3298  return FALSE;
3299  }
3300  else return TRUE;
3301  }
3302  else
3303  /*==================== subring =================*/
3304  if (strcmp(sys_cmd, "subring") == 0)
3305  {
3306  if (h!=NULL)
3307  {
3308  extern ring rSubring(ring r,leftv v); /* ipshell.cc*/
3309  res->data=(char *)rSubring(currRing,h);
3310  res->rtyp=RING_CMD;
3311  return res->data==NULL;
3312  }
3313  else return TRUE;
3314  }
3315  else
3316  /*==================== HNF =================*/
3317  #ifdef HAVE_NTL
3318  if (strcmp(sys_cmd, "HNF") == 0)
3319  {
3320  if (h!=NULL)
3321  {
3322  res->rtyp=h->Typ();
3323  if (h->Typ()==MATRIX_CMD)
3324  {
3325  res->data=(char *)singntl_HNF((matrix)h->Data(), currRing);
3326  return FALSE;
3327  }
3328  else if (h->Typ()==INTMAT_CMD)
3329  {
3330  res->data=(char *)singntl_HNF((intvec*)h->Data());
3331  return FALSE;
3332  }
3333  else if (h->Typ()==INTMAT_CMD)
3334  {
3335  res->data=(char *)singntl_HNF((intvec*)h->Data());
3336  return FALSE;
3337  }
3338  else
3339  {
3340  WerrorS("expected `system(\"HNF\",<matrix|intmat|bigintmat>)`");
3341  return TRUE;
3342  }
3343  }
3344  else return TRUE;
3345  }
3346  else
3347  /*================= probIrredTest ======================*/
3348  if (strcmp (sys_cmd, "probIrredTest") == 0)
3349  {
3350  if (h!=NULL && (h->Typ()== POLY_CMD) && ((h->next != NULL) && h->next->Typ() == STRING_CMD))
3351  {
3352  CanonicalForm F= convSingPFactoryP((poly)(h->Data()), currRing);
3353  char *s=(char *)h->next->Data();
3354  double error= atof (s);
3355  int irred= probIrredTest (F, error);
3356  res->rtyp= INT_CMD;
3357  res->data= (void*)(long)irred;
3358  return FALSE;
3359  }
3360  else return TRUE;
3361  }
3362  else
3363  #endif
3364  /*==================== mpz_t loader ======================*/
3365  if(strcmp(sys_cmd, "GNUmpLoad")==0)
3366  {
3367  if ((h != NULL) && (h->Typ() == STRING_CMD))
3368  {
3369  char* filename = (char*)h->Data();
3370  FILE* f = fopen(filename, "r");
3371  if (f == NULL)
3372  {
3373  WerrorS( "invalid file name (in paths use '/')");
3374  return FALSE;
3375  }
3376  mpz_t m; mpz_init(m);
3377  mpz_inp_str(m, f, 10);
3378  fclose(f);
3379  number n = n_InitMPZ(m, coeffs_BIGINT);
3380  res->rtyp = BIGINT_CMD;
3381  res->data = (void*)n;
3382  return FALSE;
3383  }
3384  else
3385  {
3386  WerrorS( "expected valid file name as a string");
3387  return TRUE;
3388  }
3389  }
3390  else
3391  /*==================== intvec matching ======================*/
3392  /* Given two non-empty intvecs, the call
3393  'system("intvecMatchingSegments", ivec, jvec);'
3394  computes all occurences of jvec in ivec, i.e., it returns
3395  a list of int indices k such that ivec[k..size(jvec)+k-1] = jvec.
3396  If no such k exists (e.g. when ivec is shorter than jvec), an
3397  intvec with the single entry 0 is being returned. */
3398  if(strcmp(sys_cmd, "intvecMatchingSegments")==0)
3399  {
3400  if ((h != NULL) && (h->Typ() == INTVEC_CMD) &&
3401  (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
3402  (h->next->next == NULL))
3403  {
3404  intvec* ivec = (intvec*)h->Data();
3405  intvec* jvec = (intvec*)h->next->Data();
3406  intvec* r = new intvec(1); (*r)[0] = 0;
3407  int validEntries = 0;
3408  for (int k = 0; k <= ivec->rows() - jvec->rows(); k++)
3409  {
3410  if (memcmp(&(*ivec)[k], &(*jvec)[0],
3411  sizeof(int) * jvec->rows()) == 0)
3412  {
3413  if (validEntries == 0)
3414  (*r)[0] = k + 1;
3415  else
3416  {
3417  r->resize(validEntries + 1);
3418  (*r)[validEntries] = k + 1;
3419  }
3420  validEntries++;
3421  }
3422  }
3423  res->rtyp = INTVEC_CMD;
3424  res->data = (void*)r;
3425  return FALSE;
3426  }
3427  else
3428  {
3429  WerrorS("expected two non-empty intvecs as arguments");
3430  return TRUE;
3431  }
3432  }
3433  else
3434  /* ================== intvecOverlap ======================= */
3435  /* Given two non-empty intvecs, the call
3436  'system("intvecOverlap", ivec, jvec);'
3437  computes the longest intvec kvec such that ivec ends with kvec
3438  and jvec starts with kvec. The length of this overlap is being
3439  returned. If there is no overlap at all, then 0 is being returned. */
3440  if(strcmp(sys_cmd, "intvecOverlap")==0)
3441  {
3442  if ((h != NULL) && (h->Typ() == INTVEC_CMD) &&
3443  (h->next != NULL) && (h->next->Typ() == INTVEC_CMD) &&
3444  (h->next->next == NULL))
3445  {
3446  intvec* ivec = (intvec*)h->Data();
3447  intvec* jvec = (intvec*)h->next->Data();
3448  int ir = ivec->rows(); int jr = jvec->rows();
3449  int r = jr; if (ir < jr) r = ir; /* r = min{ir, jr} */
3450  while ((r >= 1) && (memcmp(&(*ivec)[ir - r], &(*jvec)[0],
3451  sizeof(int) * r) != 0))
3452  r--;
3453  res->rtyp = INT_CMD;
3454  res->data = (void*)(long)r;
3455  return FALSE;
3456  }
3457  else
3458  {
3459  WerrorS("expected two non-empty intvecs as arguments");
3460  return TRUE;
3461  }
3462  }
3463  else
3464  /*==================== Hensel's lemma ======================*/
3465  if(strcmp(sys_cmd, "henselfactors")==0)
3466  {
3467  if ((h != NULL) && (h->Typ() == INT_CMD) &&
3468  (h->next != NULL) && (h->next->Typ() == INT_CMD) &&
3469  (h->next->next != NULL) && (h->next->next->Typ() == POLY_CMD) &&
3470  (h->next->next->next != NULL) &&
3471  (h->next->next->next->Typ() == POLY_CMD) &&
3472  (h->next->next->next->next != NULL) &&
3473  (h->next->next->next->next->Typ() == POLY_CMD) &&
3474  (h->next->next->next->next->next != NULL) &&
3475  (h->next->next->next->next->next->Typ() == INT_CMD) &&
3476  (h->next->next->next->next->next->next == NULL))
3477  {
3478  int xIndex = (int)(long)h->Data();
3479  int yIndex = (int)(long)h->next->Data();
3480  poly hh = (poly)h->next->next->Data();
3481  poly f0 = (poly)h->next->next->next->Data();
3482  poly g0 = (poly)h->next->next->next->next->Data();
3483  int d = (int)(long)h->next->next->next->next->next->Data();
3484  poly f; poly g;
3485  henselFactors(xIndex, yIndex, hh, f0, g0, d, f, g);
3487  L->Init(2);
3488  L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
3489  L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
3490  res->rtyp = LIST_CMD;
3491  res->data = (char *)L;
3492  return FALSE;
3493  }
3494  else
3495  {
3496  WerrorS( "expected argument list (int, int, poly, poly, poly, int)");
3497  return TRUE;
3498  }
3499  }
3500  else
3501  /*==================== Approx_Step =================*/
3502  #ifdef HAVE_PLURAL
3503  if (strcmp(sys_cmd, "astep") == 0)
3504  {
3505  ideal I;
3506  if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
3507  {
3508  I=(ideal)h->CopyD();
3509  res->rtyp=IDEAL_CMD;
3510  if (rIsPluralRing(currRing)) res->data=Approx_Step(I);
3511  else res->data=I;
3512  setFlag(res,FLAG_STD);
3513  }
3514  else return TRUE;
3515  return FALSE;
3516  }
3517  else
3518  #endif
3519  /*==================== PrintMat =================*/
3520  #ifdef HAVE_PLURAL
3521  if (strcmp(sys_cmd, "PrintMat") == 0)
3522  {
3523  int a;
3524  int b;
3525  ring r;
3526  int metric;
3527  if (h!=NULL)
3528  {
3529  if (h->Typ()==INT_CMD)
3530  {
3531  a=(int)((long)(h->Data()));
3532  h=h->next;
3533  }
3534  else if (h->Typ()==INT_CMD)
3535  {
3536  b=(int)((long)(h->Data()));
3537  h=h->next;
3538  }
3539  else if (h->Typ()==RING_CMD)
3540  {
3541  r=(ring)h->Data();
3542  h=h->next;
3543  }
3544  else
3545  return TRUE;
3546  }
3547  else
3548  return TRUE;
3549  if ((h!=NULL) && (h->Typ()==INT_CMD))
3550  {
3551  metric=(int)((long)(h->Data()));
3552  }
3553  res->rtyp=MATRIX_CMD;
3554  if (rIsPluralRing(r)) res->data=nc_PrintMat(a,b,r,metric);
3555  else res->data=NULL;
3556  return FALSE;
3557  }
3558  else
3559  #endif
3560 /* ============ NCUseExtensions ======================== */
3561  #ifdef HAVE_PLURAL
3562  if(strcmp(sys_cmd,"NCUseExtensions")==0)
3563  {
3564  if ((h!=NULL) && (h->Typ()==INT_CMD))
3565  res->data=(void *)(long)setNCExtensions( (int)((long)(h->Data())) );
3566  else
3567  res->data=(void *)(long)getNCExtensions();
3568  res->rtyp=INT_CMD;
3569  return FALSE;
3570  }
3571  else
3572  #endif
3573 /* ============ NCGetType ======================== */
3574  #ifdef HAVE_PLURAL
3575  if(strcmp(sys_cmd,"NCGetType")==0)
3576  {
3577  res->rtyp=INT_CMD;
3578  if( rIsPluralRing(currRing) )
3579  res->data=(void *)(long)ncRingType(currRing);
3580  else
3581  res->data=(void *)(-1L);
3582  return FALSE;
3583  }
3584  else
3585  #endif
3586 /* ============ ForceSCA ======================== */
3587  #ifdef HAVE_PLURAL
3588  if(strcmp(sys_cmd,"ForceSCA")==0)
3589  {
3590  if( !rIsPluralRing(currRing) )
3591  return TRUE;
3592  int b, e;
3593  if ((h!=NULL) && (h->Typ()==INT_CMD))
3594  {
3595  b = (int)((long)(h->Data()));
3596  h=h->next;
3597  }
3598  else return TRUE;
3599  if ((h!=NULL) && (h->Typ()==INT_CMD))
3600  {
3601  e = (int)((long)(h->Data()));
3602  }
3603  else return TRUE;
3604  if( !sca_Force(currRing, b, e) )
3605  return TRUE;
3606  return FALSE;
3607  }
3608  else
3609  #endif
3610 /* ============ ForceNewNCMultiplication ======================== */
3611  #ifdef HAVE_PLURAL
3612  if(strcmp(sys_cmd,"ForceNewNCMultiplication")==0)
3613  {
3614  if( !rIsPluralRing(currRing) )
3615  return TRUE;
3616  if( !ncInitSpecialPairMultiplication(currRing) ) // No Plural!
3617  return TRUE;
3618  return FALSE;
3619  }
3620  else
3621  #endif
3622 /* ============ ForceNewOldNCMultiplication ======================== */
3623  #ifdef HAVE_PLURAL
3624  if(strcmp(sys_cmd,"ForceNewOldNCMultiplication")==0)
3625  {
3626  if( !rIsPluralRing(currRing) )
3627  return TRUE;
3628  if( !ncInitSpecialPowersMultiplication(currRing) ) // Enable Formula for Plural (depends on swiches)!
3629  return TRUE;
3630  return FALSE;
3631  }
3632  else
3633  #endif
3634 /*==================== test64 =================*/
3635  #if 0
3636  if(strcmp(sys_cmd,"test64")==0)
3637  {
3638  long l=8;int i;
3639  for(i=1;i<62;i++)
3640  {
3641  l=l<<1;
3642  number n=n_Init(l,coeffs_BIGINT);
3643  Print("%ld= ",l);n_Print(n,coeffs_BIGINT);
3645  n_Delete(&n,coeffs_BIGINT);
3647  PrintS(" F:");
3649  PrintLn();
3650  n_Delete(&n,coeffs_BIGINT);
3651  }
3652  Print("SIZEOF_LONG=%d\n",SIZEOF_LONG);
3653  return FALSE;
3654  }
3655  else
3656  #endif
3657 /*==================== n_SwitchChinRem =================*/
3658  if(strcmp(sys_cmd,"cache_chinrem")==0)
3659  {
3661  Print("caching inverse in chines remainder:%d\n",n_SwitchChinRem);
3662  if ((h!=NULL)&&(h->Typ()==INT_CMD))
3663  n_SwitchChinRem=(int)(long)h->Data();
3664  return FALSE;
3665  }
3666  else
3667 /*==================== LU for bigintmat =================*/
3668 #ifdef SINGULAR_4_2
3669  if(strcmp(sys_cmd,"LU")==0)
3670  {
3671  if ((h!=NULL) && (h->Typ()==CMATRIX_CMD))
3672  {
3673  // get the argument:
3674  bigintmat *b=(bigintmat *)h->Data();
3675  // just for tests: simply transpose
3676  bigintmat *bb=b->transpose();
3677  // return the result:
3678  res->rtyp=CMATRIX_CMD;
3679  res->data=(char*)bb;
3680  return FALSE;
3681  }
3682  else
3683  {
3684  WerrorS("system(\"LU\",<cmatrix>) expected");
3685  return TRUE;
3686  }
3687  }
3688  else
3689 #endif
3690 /*==================== sort =================*/
3691  if(strcmp(sys_cmd,"sort")==0)
3692  {
3693  extern BOOLEAN jjSORTLIST(leftv,leftv);
3694  if (h->Typ()==LIST_CMD)
3695  return jjSORTLIST(res,h);
3696  else
3697  return TRUE;
3698  }
3699  else
3700 /*==================== uniq =================*/
3701  if(strcmp(sys_cmd,"uniq")==0)
3702  {
3703  extern BOOLEAN jjUNIQLIST(leftv, leftv);
3704  if (h->Typ()==LIST_CMD)
3705  return jjUNIQLIST(res,h);
3706  else
3707  return TRUE;
3708  }
3709  else
3710 /*==================== GF(p,n) ==================================*/
3711  if(strcmp(sys_cmd,"GF")==0)
3712  {
3713  const short t[]={3,INT_CMD,INT_CMD,STRING_CMD};
3714  if (iiCheckTypes(h,t,1))
3715  {
3716  int p=(int)(long)h->Data();
3717  int n=(int)(long)h->next->Data();
3718  char *v=(char*)h->next->next->CopyD();
3719  GFInfo param;
3720  param.GFChar = p;
3721  param.GFDegree = n;
3722  param.GFPar_name = v;
3723  coeffs cf= nInitChar(n_GF, &param);
3724  res->rtyp=CRING_CMD;
3725  res->data=cf;
3726  return FALSE;
3727  }
3728  else
3729  return TRUE;
3730  }
3731  else
3732 /*==================== power* ==================================*/
3733  #if 0
3734  if(strcmp(sys_cmd,"power1")==0)
3735  {
3736  res->rtyp=POLY_CMD;
3737  poly f=(poly)h->CopyD();
3738  poly g=pPower(f,2000);
3739  res->data=(void *)g;
3740  return FALSE;
3741  }
3742  else
3743  if(strcmp(sys_cmd,"power2")==0)
3744  {
3745  res->rtyp=POLY_CMD;
3746  poly f=(poly)h->Data();
3747  poly g=pOne();
3748  for(int i=0;i<2000;i++)
3749  g=pMult(g,pCopy(f));
3750  res->data=(void *)g;
3751  return FALSE;
3752  }
3753  if(strcmp(sys_cmd,"power3")==0)
3754  {
3755  res->rtyp=POLY_CMD;
3756  poly f=(poly)h->Data();
3757  poly p2=pMult(pCopy(f),pCopy(f));
3758  poly p4=pMult(pCopy(p2),pCopy(p2));
3759  poly p8=pMult(pCopy(p4),pCopy(p4));
3760  poly p16=pMult(pCopy(p8),pCopy(p8));
3761  poly p32=pMult(pCopy(p16),pCopy(p16));
3762  poly p64=pMult(pCopy(p32),pCopy(p32));
3763  poly p128=pMult(pCopy(p64),pCopy(p64));
3764  poly p256=pMult(pCopy(p128),pCopy(p128));
3765  poly p512=pMult(pCopy(p256),pCopy(p256));
3766  poly p1024=pMult(pCopy(p512),pCopy(p512));
3767  poly p1536=pMult(p1024,p512);
3768  poly p1792=pMult(p1536,p256);
3769  poly p1920=pMult(p1792,p128);
3770  poly p1984=pMult(p1920,p64);
3771  poly p2000=pMult(p1984,p16);
3772  res->data=(void *)p2000;
3773  pDelete(&p2);
3774  pDelete(&p4);
3775  pDelete(&p8);
3776  //pDelete(&p16);
3777  pDelete(&p32);
3778  //pDelete(&p64);
3779  //pDelete(&p128);
3780  //pDelete(&p256);
3781  //pDelete(&p512);
3782  //pDelete(&p1024);
3783  //pDelete(&p1536);
3784  //pDelete(&p1792);
3785  //pDelete(&p1920);
3786  //pDelete(&p1984);
3787  return FALSE;
3788  }
3789  else
3790  #endif
3791 /* ccluster --------------------------------------------------------------*/
3792 #ifdef HAVE_CCLUSTER
3793  if(strcmp(sys_cmd,"ccluster")==0)
3794  {
3795  if ((currRing!=NULL)
3797  {
3798  const short t[]={5,POLY_CMD,NUMBER_CMD,NUMBER_CMD,NUMBER_CMD,NUMBER_CMD};
3800 
3801 // printf("test t : %d\n", h->Typ()==POLY_CMD);
3802 // printf("test t : %d\n", h->next->Typ()==POLY_CMD);
3803  int pol_with_complex_coeffs=0;
3804  if (h->next->Typ()==POLY_CMD)
3805  pol_with_complex_coeffs=1;
3806 
3807  if ( (pol_with_complex_coeffs==0 && iiCheckTypes(h,t,1))
3808  ||(pol_with_complex_coeffs==1 && iiCheckTypes(h,t2,1)) )
3809  {
3810  // convert first arg. to fmpq_poly_t
3811  fmpq_poly_t fre, fim;
3812  convSingPFlintP(fre,(poly)h->Data(),currRing); h=h->next;
3813  if (pol_with_complex_coeffs==1)
3814  { // convert second arg. to fmpq_poly_t
3815  convSingPFlintP(fim,(poly)h->Data(),currRing); h=h->next;
3816  }
3817  // convert box-center(re,im), box-size, epsilon
3818  fmpq_t center_re,center_im,boxsize,eps;
3819  convSingNFlintN(center_re,(number)h->Data(),currRing->cf); h=h->next;
3820  convSingNFlintN(center_im,(number)h->Data(),currRing->cf); h=h->next;
3821  convSingNFlintN(boxsize,(number)h->Data(),currRing->cf); h=h->next;
3822  convSingNFlintN(eps,(number)h->Data(),currRing->cf); h=h->next;
3823  // alloc arrays
3824  int n=fmpq_poly_length(fre);
3825  fmpq_t* re_part=(fmpq_t*)omAlloc(n*sizeof(fmpq_t));
3826  fmpq_t* im_part=(fmpq_t*)omAlloc(n*sizeof(fmpq_t));
3827  int *mult =(int*) omAlloc(n*sizeof(int));
3828  for(int i=0; i<n;i++)
3829  { fmpq_init(re_part[i]); fmpq_init(im_part[i]); }
3830  // call cccluster, adjust n
3831  int verbosity =0; //nothing is printed
3832  int strategy = 23; //default strategy
3833  int nn=0;
3834  long nb_threads = (long) feOptValue(FE_OPT_CPUS);
3835  strategy = strategy+(nb_threads<<6);
3836 // printf("nb threads: %ld\n", nb_threads);
3837 // printf("strategy: %ld\n", strategy);
3838  if (pol_with_complex_coeffs==0)
3839  nn=ccluster_interface_poly_real(re_part,im_part,mult,fre,center_re,center_im,boxsize,eps,strategy,verbosity);
3840  else
3841  nn=ccluster_interface_poly_real_imag(re_part,im_part,mult,fre,fim,center_re,center_im,boxsize,eps,strategy,verbosity);
3842  // convert to list
3844  l->Init(nn);
3845  for(int i=0; i<nn;i++)
3846  {
3848  l->m[i].rtyp=LIST_CMD;
3849  l->m[i].data=ll;
3850  ll->Init(3);
3851  ll->m[0].rtyp=NUMBER_CMD;
3852  ll->m[1].rtyp=NUMBER_CMD;
3853  ll->m[2].rtyp=INT_CMD;
3854  ll->m[0].data=convFlintNSingN(re_part[i],currRing->cf);
3855  ll->m[1].data=convFlintNSingN(im_part[i],currRing->cf);
3856  ll->m[2].data=(void *)(long)mult[i];
3857  }
3858  //clear re, im, mults, fre, fim
3859  for(int i=n-1;i>=0;i--) { fmpq_clear(re_part[i]); fmpq_clear(im_part[i]); }
3860  omFree(re_part);
3861  omFree(im_part);
3862  omFree(mult);
3863  fmpq_clear(center_re); fmpq_clear(center_im); fmpq_clear(boxsize); fmpq_clear(eps);
3864  fmpq_poly_clear(fre);
3865  if (pol_with_complex_coeffs==1) fmpq_poly_clear(fim);
3866  // result
3867  res->rtyp=LIST_CMD;
3868  res->data=l;
3869  return FALSE;
3870  }
3871  }
3872  return TRUE;
3873  }
3874  else
3875 #endif
3876 /* ====== maEvalAt ============================*/
3877  if(strcmp(sys_cmd,"evaluate")==0)
3878  {
3879  extern number maEvalAt(const poly p,const number* pt, const ring r);
3880  if (h->Typ()!=POLY_CMD)
3881  {
3882  WerrorS("expected system(\"evaluate\",<poly>,..)");
3883  return TRUE;
3884  }
3885  poly p=(poly)h->Data();
3886  number *pt=(number*)omAlloc(sizeof(number)*currRing->N);
3887  for(int i=0;i<currRing->N;i++)
3888  {
3889  h=h->next;
3890  if ((h==NULL)||(h->Typ()!=NUMBER_CMD))
3891  {
3892  WerrorS("system(\"evaluate\",<poly>,<number>..) - expect number");
3893  return TRUE;
3894  }
3895  pt[i]=(number)h->Data();
3896  }
3897  res->data=maEvalAt(p,pt,currRing);
3898  res->rtyp=NUMBER_CMD;
3899  return FALSE;
3900  }
3901  else
3902 /*==================== Error =================*/
3903  Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented );
3904  }
3905  return TRUE;
3906 }
3907 
3908 #endif // HAVE_EXTENDED_SYSTEM
3909 
3910 
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
void * ADDRESS
Definition: auxiliary.h:119
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:133
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:17
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
Definition: blackbox.cc:218
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:235
#define BB_LIKE_LIST(B)
Definition: blackbox.h:53
lists testsvd(matrix M)
Definition: calcSVD.cc:27
bool isOn(int sw)
switches
void On(int sw)
switches
void Off(int sw)
switches
int degree(const CanonicalForm &f)
void FACTORY_PUBLIC setCharacteristic(int c)
Definition: cf_char.cc:28
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:676
int l
Definition: cfEzgcd.cc:100
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
int p
Definition: cfModGcd.cc:4080
g
Definition: cfModGcd.cc:4092
CanonicalForm cf
Definition: cfModGcd.cc:4085
CanonicalForm b
Definition: cfModGcd.cc:4105
EXTERN_VAR int singular_homog_flag
Definition: cf_algorithm.h:65
static const int SW_USE_CHINREM_GCD
set to 1 to use modular gcd over Z
Definition: cf_defs.h:40
static const int SW_USE_FL_GCD_P
set to 1 to use Flints gcd over F_p
Definition: cf_defs.h:46
static const int SW_USE_EZGCD_P
set to 1 to use EZGCD over F_q
Definition: cf_defs.h:36
static const int SW_USE_EZGCD
set to 1 to use EZGCD over Z
Definition: cf_defs.h:34
static const int SW_USE_FL_GCD_0
set to 1 to use Flints gcd over Q/Z
Definition: cf_defs.h:48
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
void factoryseed(int s)
random seed initializer
Definition: cf_random.cc:189
FILE * f
Definition: checklibs.c:9
CanonicalForm convSingPFactoryP(poly p, const ring r)
Definition: clapconv.cc:136
char * singclap_neworder(ideal I, const ring r)
Definition: clapsing.cc:1630
matrix singntl_HNF(matrix m, const ring s)
Definition: clapsing.cc:1783
matrix singntl_LLL(matrix m, const ring s)
Definition: clapsing.cc:1881
ideal singclap_absFactorize(poly f, ideal &mipos, intvec **exps, int &numFactors, const ring r)
Definition: clapsing.cc:1963
factory's main class
Definition: canonicalform.h:86
Matrices of numbers.
Definition: bigintmat.h:51
gmp_complex numbers based on
Definition: mpr_complex.h:179
Definition: idrec.h:35
Definition: intvec.h:23
void resize(int new_length)
Definition: intvec.cc:106
int rows() const
Definition: intvec.h:96
int & rows()
Definition: matpol.h:23
int & cols()
Definition: matpol.h:24
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:1011
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1154
leftv next
Definition: subexpr.h:86
void * data
Definition: subexpr.h:88
Definition: lists.h:24
sleftv * m
Definition: lists.h:46
INLINE_THIS void Init(int l=0)
Definition: int_poly.h:33
VAR int siRandomStart
Definition: cntrlc.cc:101
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition: coeffs.h:548
int GFDegree
Definition: coeffs.h:96
@ n_GF
\GF{p^n < 2^16}
Definition: coeffs.h:33
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
CanonicalForm n_convSingNFactoryN(number n, BOOLEAN setChar, const coeffs r)
Definition: numbers.cc:629
void n_Print(number &a, const coeffs r)
print a number (BEWARE of string buffers!) mostly for debugging
Definition: numbers.cc:613
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:353
number n_convFactoryNSingN(const CanonicalForm n, const coeffs r)
Definition: numbers.cc:624
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:445
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
conversion of a GMP integer to number
Definition: coeffs.h:543
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:539
const char * GFPar_name
Definition: coeffs.h:97
int GFChar
Definition: coeffs.h:95
Creation data needed for finite fields.
Definition: coeffs.h:94
void countedref_reference_load()
Initialize blackbox types 'reference' and 'shared', or both.
Definition: countedref.cc:700
void countedref_shared_load()
Definition: countedref.cc:724
lists get_denom_list()
Definition: denom_list.cc:8
poly uni_subst_bits(poly outer_uni, poly inner_multi, ring r)
Definition: digitech.cc:47
matrix evRowElim(matrix M, int i, int j, int k)
Definition: eigenval.cc:47
matrix evHessenberg(matrix M)
Definition: eigenval.cc:100
matrix evSwap(matrix M, int i, int j)
Definition: eigenval.cc:25
lists evEigenvals(matrix M)
Definition: eigenval_ip.cc:118
#define Print
Definition: emacs.cc:80
#define Warn
Definition: emacs.cc:77
#define WarnS
Definition: emacs.cc:78
void error(const char *fmt,...)
Definition: emacs.cc:55
BOOLEAN jjSYSTEM(leftv res, leftv args)
Definition: extra.cc:230
poly longCoeffsToSingularPoly(unsigned long *polyCoeffs, const int degree)
Definition: extra.cc:207
unsigned long ** singularMatrixToLongMatrix(matrix singularMatrix)
Definition: extra.cc:175
#define TEST_FOR(A)
static BOOLEAN jjEXTENDED_SYSTEM(leftv res, leftv h)
Definition: extra.cc:2273
ideal F5main(ideal id, ring r, int opt, int plus, int termination)
Definition: f5gb.cc:1889
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
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
CFList int bool & irred
[in,out] Is A irreducible?
Definition: facFactorize.h:34
int j
Definition: facHensel.cc:110
int probIrredTest(const CanonicalForm &F, double error)
given some error probIrredTest detects irreducibility or reducibility of F with confidence level 1-er...
Definition: facIrredTest.cc:63
poly unifastmult(poly f, poly g, ring r)
Definition: fast_mult.cc:272
poly pFastPowerMC(poly f, int n, ring r)
Definition: fast_mult.cc:588
static int max(int a, int b)
Definition: fast_mult.cc:264
poly pFastPower(poly f, int n, ring r)
Definition: fast_mult.cc:342
int Mults()
Definition: fast_mult.cc:14
poly multifastmult(poly f, poly g, ring r)
Definition: fast_mult.cc:290
void WerrorS(const char *s)
Definition: feFopen.cc:24
feOptIndex
Definition: feOptGen.h:15
@ FE_OPT_UNDEF
Definition: feOptGen.h:15
void fePrintOptValues()
Definition: feOpt.cc:337
const char * feSetOptValue(feOptIndex opt, char *optarg)
Definition: feOpt.cc:154
feOptIndex feGetOptIndex(const char *name)
Definition: feOpt.cc:104
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
EXTERN_VAR struct fe_option feOptSpec[]
Definition: feOpt.h:17
void feReInitResources()
Definition: feResource.cc:207
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:258
VAR int myynest
Definition: febase.cc:41
char * getenv()
@ feOptUntyped
Definition: fegetopt.h:77
@ feOptString
Definition: fegetopt.h:77
void * value
Definition: fegetopt.h:93
void system(sys)
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:340
STATIC_VAR int nfMinPoly[16]
Definition: ffields.cc:549
This file is work in progress and currently not part of the official Singular.
void convSingPFlintP(fmpq_poly_t res, poly p, const ring r)
void convSingNFlintN(fmpz_t f, mpz_t z)
bigintmat * singflint_LLL(bigintmat *A, bigintmat *T)
void convFlintNSingN(mpz_t z, fmpz_t f)
number maEvalAt(const poly p, const number *pt, const ring r)
evaluate the polynomial p at the pt given by the array pt
Definition: gen_maps.cc:167
#define EXTERN_VAR
Definition: globaldefs.h:6
lists gmsNF(ideal p, ideal g, matrix B, int D, int K)
Definition: gms.cc:22
@ IDEAL_CMD
Definition: grammar.cc:284
@ MATRIX_CMD
Definition: grammar.cc:286
@ BIGINTMAT_CMD
Definition: grammar.cc:278
@ PROC_CMD
Definition: grammar.cc:280
@ INTMAT_CMD
Definition: grammar.cc:279
@ MODUL_CMD
Definition: grammar.cc:287
@ SMATRIX_CMD
Definition: grammar.cc:291
@ VECTOR_CMD
Definition: grammar.cc:292
@ NUMBER_CMD
Definition: grammar.cc:288
@ POLY_CMD
Definition: grammar.cc:289
@ RING_CMD
Definition: grammar.cc:281
void HilbertSeries_OrbitData(ideal S, int lV, bool IG_CASE, bool mgrad, bool odp, int trunDegHs)
Definition: hilb.cc:1974
ideal RightColonOperation(ideal S, poly w, int lV)
Definition: hilb.cc:2321
void slicehilb(ideal I)
Definition: hilb.cc:1130
ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing)
STATIC_VAR coordinates * points
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:257
#define ivTest(v)
Definition: intvec.h:158
#define IMATELEM(M, I, J)
Definition: intvec.h:85
BOOLEAN jjSORTLIST(leftv, leftv arg)
Definition: iparith.cc:10156
BOOLEAN jjUNIQLIST(leftv, leftv arg)
Definition: iparith.cc:10165
VAR idhdl currRingHdl
Definition: ipid.cc:59
VAR coeffs coeffs_BIGINT
Definition: ipid.cc:50
#define IDDATA(a)
Definition: ipid.h:126
#define setFlag(A, F)
Definition: ipid.h:113
#define FLAG_TWOSTD
Definition: ipid.h:107
#define IDRING(a)
Definition: ipid.h:127
#define FLAG_STD
Definition: ipid.h:106
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4437
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:6564
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:4520
BOOLEAN spectrumfProc(leftv result, leftv first)
Definition: ipshell.cc:4193
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4479
BOOLEAN spectrumProc(leftv result, leftv first)
Definition: ipshell.cc:4142
ring rSubring(ring org_ring, sleftv *rv)
Definition: ipshell.cc:6017
BOOLEAN semicProc(leftv res, leftv u, leftv v)
Definition: ipshell.cc:4560
char * versionString()
Definition: misc_ip.cc:782
STATIC_VAR jList * T
Definition: janet.cc:30
STATIC_VAR TreeM * G
Definition: janet.cc:31
STATIC_VAR Poly * h
Definition: janet.cc:971
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1142
poly fglmLinearCombination(ideal source, poly monset)
Definition: fglmcomb.cc:415
poly fglmNewLinearCombination(ideal source, poly monset)
Definition: fglmcomb.cc:153
poly kNFBound(ideal F, ideal Q, poly p, int bound, int syzComp, int lazyReduce)
Definition: kstd1.cc:3213
poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing)
Definition: kstd2.cc:526
VAR int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:81
VAR int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:80
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5805
VAR int HCord
Definition: kutil.cc:246
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5400
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5342
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5331
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5370
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:12046
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5642
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5912
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11955
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5710
ideal createG0()
Definition: kutil.cc:4527
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5553
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6039
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:12009
BOOLEAN kVerify2(ideal F, ideal Q)
Definition: kverify.cc:121
BOOLEAN kVerify1(ideal F, ideal Q)
Definition: kverify.cc:20
static bool rIsSCA(const ring r)
Definition: nc.h:190
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3342
int & getNCExtensions()
Definition: old.gring.cc:82
int setNCExtensions(int iMask)
Definition: old.gring.cc:87
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2243
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:159
matrix nc_PrintMat(int a, int b, ring r, int metric)
returns matrix with the info on noncomm multiplication
Definition: old.gring.cc:2394
bool sca_Force(ring rGR, int b, int e)
Definition: sca.cc:1161
bool luSolveViaLDUDecomp(const matrix pMat, const matrix lMat, const matrix dMat, const matrix uMat, const poly l, const poly u, const poly lTimesU, const matrix bVec, matrix &xVec, matrix &H)
Solves the linear system A * x = b, where A is an (m x n)-matrix which is given by its LDU-decomposit...
void henselFactors(const int xIndex, const int yIndex, const poly h, const poly f0, const poly g0, const int d, poly &f, poly &g)
Computes a factorization of a polynomial h(x, y) in K[[x]][y] up to a certain degree in x,...
void lduDecomp(const matrix aMat, matrix &pMat, matrix &lMat, matrix &dMat, matrix &uMat, poly &l, poly &u, poly &lTimesU)
LU-decomposition of a given (m x n)-matrix with performing only those divisions that yield zero remai...
VAR omBin slists_bin
Definition: lists.cc:23
VAR int n_SwitchChinRem
Definition: longrat.cc:3052
matrix mp_Transp(matrix a, const ring R)
Definition: matpol.cc:254
ideal sm_UnFlatten(ideal a, int col, const ring R)
Definition: matpol.cc:1946
matrix mp_InitI(int r, int c, int v, const ring R)
make it a v * unit matrix
Definition: matpol.cc:129
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
ideal sm_Flatten(ideal a, const ring R)
Definition: matpol.cc:1926
#define MATELEM(mat, i, j)
1-based access to matrix
Definition: matpol.h:29
ip_smatrix * matrix
Definition: matpol.h:43
#define MATROWS(i)
Definition: matpol.h:26
#define MATCOLS(i)
Definition: matpol.h:27
unsigned long * computeMinimalPolynomial(unsigned long **matrix, unsigned n, unsigned long p)
Definition: minpoly.cc:428
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:647
This file provides miscellaneous functionality.
#define assume(x)
Definition: mod2.h:387
#define SINGULAR_VERSION
Definition: mod2.h:85
void * dynl_sym(void *handle, const char *symbol)
Definition: mod_raw.cc:162
void * dynl_open(char *filename)
Definition: mod_raw.cc:145
#define pIter(p)
Definition: monomials.h:37
#define p_GetCoeff(p, r)
Definition: monomials.h:50
EXTERN_VAR size_t gmp_output_digits
Definition: mpr_base.h:115
bool complexNearZero(gmp_complex *c, int digits)
Definition: mpr_complex.cc:765
slists * lists
Definition: mpr_numeric.h:146
The main handler for Singular numbers which are suitable for Singular polynomials.
bool ncInitSpecialPowersMultiplication(ring r)
Definition: ncSAFormula.cc:50
BOOLEAN ncInitSpecialPairMultiplication(ring r)
Definition: ncSAMult.cc:266
ideal Approx_Step(ideal L)
Ann: ???
Definition: nc.cc:250
ideal twostd(ideal I)
Compute two-sided GB:
Definition: nc.cc:18
void newstructShow(newstruct_desc d)
Definition: newstruct.cc:826
BOOLEAN newstruct_set_proc(const char *bbname, const char *func, int args, procinfov pr)
Definition: newstruct.cc:846
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void omMarkAsStaticAddr(void *addr)
omError_t om_ErrorStatus
Definition: omError.c:13
const char * omError2String(omError_t error)
Definition: omError.c:54
const char * omError2Serror(omError_t error)
Definition: omError.c:65
omError_t om_InternalErrorStatus
Definition: omError.c:14
char * omFindExec(const char *name, char *exec)
Definition: omFindExec.c:252
#define NULL
Definition: omList.c:12
omOpts_t om_Opts
Definition: omOpts.c:13
#define MAXPATHLEN
Definition: omRet2Info.c:22
#define omPrintCurrentBackTrace(fd)
Definition: omRet2Info.h:39
VAR unsigned si_opt_2
Definition: options.c:6
#define Sy_bit(x)
Definition: options.h:31
void pPrintDivisbleByStat()
Definition: pDebug.cc:411
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1292
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:896
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 void p_Setm(poly p, const ring r)
Definition: p_polys.h:233
static unsigned pLength(poly a)
Definition: p_polys.h:191
poly pcvP2CV(poly p, int d0, int d1)
Definition: pcv.cc:280
int pcvBasis(lists b, int i, poly m, int d, int n)
Definition: pcv.cc:430
int pcvMinDeg(poly p)
Definition: pcv.cc:135
int pcvDim(int d0, int d1)
Definition: pcv.cc:400
lists pcvPMulL(poly p, lists l1)
Definition: pcv.cc:76
poly pcvCV2P(poly cv, int d0, int d1)
Definition: pcv.cc:297
lists pcvLAddL(lists l1, lists l2)
Definition: pcv.cc:31
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
Compatiblity layer for legacy polynomial operations (over currRing)
#define pAdd(p, q)
Definition: polys.h:203
#define pDelete(p_ptr)
Definition: polys.h:186
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
#define pLmDeleteAndNext(p)
like pLmDelete, returns pNext(p)
Definition: polys.h:78
#define ppJetW(p, m, iv)
Definition: polys.h:369
#define pDivideM(a, b)
Definition: polys.h:294
#define pPower(p, q)
Definition: polys.h:204
#define pMult(p, q)
Definition: polys.h:207
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
#define pIsPurePower(p)
Definition: polys.h:248
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185
#define pOne()
Definition: polys.h:315
poly nc_rat_CreateSpoly(poly pp1, poly pp2, int ishift, const ring r)
Definition: ratgring.cc:340
int redRat(poly *h, poly *reducer, int *red_length, int rl, int ishift, ring r)
Definition: ratgring.cc:593
poly nc_rat_ReduceSpolyNew(const poly p1, poly p2, int ishift, const ring r)
Definition: ratgring.cc:465
void StringSetS(const char *st)
Definition: reporter.cc:128
const char feNotImplemented[]
Definition: reporter.cc:54
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:3403
void p_DebugPrint(poly p, const ring r)
Definition: ring.cc:4280
int rChar(ring r)
Definition: ring.cc:714
void rDebugPrint(const ring r)
Definition: ring.cc:4075
ring rOpposite(ring src)
Definition: ring.cc:5253
ring rEnvelope(ring R)
Definition: ring.cc:5643
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:5036
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:489
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:523
static int rBlocks(ring r)
Definition: ring.h:573
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:400
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:550
@ ringorder_s
s?
Definition: ring.h:76
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:511
static BOOLEAN rIsNCRing(const ring r)
Definition: ring.h:421
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:547
poly ringNF(poly f, ideal G, ring r)
Definition: ringgb.cc:199
poly plain_spoly(poly f, poly g)
Definition: ringgb.cc:168
poly ringRedNF(poly f, ideal G, ring r)
Definition: ringgb.cc:117
int testGB(ideal I, ideal GI)
Definition: ringgb.cc:226
static short scaLastAltVar(ring r)
Definition: sca.h:25
static short scaFirstAltVar(ring r)
Definition: sca.h:18
VAR int sdb_flags
Definition: sdb.cc:31
void sdb_edit(procinfo *pi)
Definition: sdb.cc:109
int simpleipc_cmd(char *cmd, int id, int v)
Definition: semaphore.c:167
int status int fd
Definition: si_signals.h:59
ideal id_Vec2Ideal(poly vec, const ring R)
#define IDELEMS(i)
Definition: simpleideals.h:23
#define R
Definition: sirandom.c:27
VAR int siSeed
Definition: sirandom.c:30
#define M
Definition: sirandom.c:25
@ testHomog
Definition: structs.h:43
procinfo * procinfov
Definition: structs.h:65
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1536
@ BIGINT_CMD
Definition: tok.h:38
@ CRING_CMD
Definition: tok.h:56
@ LIST_CMD
Definition: tok.h:118
@ INTVEC_CMD
Definition: tok.h:101
@ CMATRIX_CMD
Definition: tok.h:46
@ DEF_CMD
Definition: tok.h:58
@ LINK_CMD
Definition: tok.h:117
@ STRING_CMD
Definition: tok.h:185
@ INT_CMD
Definition: tok.h:96
#define NONE
Definition: tok.h:221
int dim(ideal I, ring r)
int M3ivSame(intvec *temp, intvec *u, intvec *v)
Definition: walk.cc:914
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1401
intvec * MivUnit(int nV)
Definition: walk.cc:1496
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:963
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2570
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1512
ideal TranMImprovwalk(ideal G, intvec *curr_weight, intvec *target_tmp, int nP)
Definition: walk.cc:8396
ideal Mfwalk(ideal G, intvec *ivstart, intvec *ivtarget, int reduction, int printout)
Definition: walk.cc:8031
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1088
intvec * MPertVectorslp(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1299
ideal Mprwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int op_deg, int tp_deg, int nP, int reduction, int printout)
Definition: walk.cc:6388
intvec * MivWeightOrderdp(intvec *ivstart)
Definition: walk.cc:1456
intvec * Mivdp(int nR)
Definition: walk.cc:1007
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1417
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1436
ideal MAltwalk2(ideal Go, intvec *curr_weight, intvec *target_weight)
Definition: walk.cc:4280
ideal MAltwalk1(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight)
Definition: walk.cc:9671
ideal Mrwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int pert_deg, int reduction, int printout)
Definition: walk.cc:5603
ideal Mfrwalk(ideal G, intvec *ivstart, intvec *ivtarget, int weight_rad, int reduction, int printout)
Definition: walk.cc:8212
ideal Mwalk(ideal Go, intvec *orig_M, intvec *target_M, ring baseRing, int reduction, int printout)
Definition: walk.cc:5302
ideal Mpwalk(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight, int nP, int reduction, int printout)
Definition: walk.cc:5947
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:893
intvec * Mivlp(int nR)
Definition: walk.cc:1022
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:761
intvec * MPertNextWeight(intvec *iva, ideal G, int deg)
intvec * MwalkNextWeight(intvec *curr_weight, intvec *target_weight, ideal G)
intvec * Mivperttarget(ideal G, int ndeg)
int * iv2array(intvec *iv, const ring R)
Definition: weight.cc:200
#define omPrintUsedTrackAddrs(F, max)
Definition: xalloc.h:314
#define omUpdateInfo()
Definition: xalloc.h:274