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