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