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