17 #include <factory/factory.h> 25 #ifdef TIME_WITH_SYS_TIME 27 # ifdef HAVE_SYS_TIME_H 28 # include <sys/time.h> 31 # ifdef HAVE_SYS_TIME_H 32 # include <sys/time.h> 37 #ifdef HAVE_SYS_TIMES_H 38 #include <sys/times.h> 145 #ifndef MAKE_DISTRIBUTION 146 #define HAVE_EXTENDED_SYSTEM 1 163 #ifdef HAVE_SIMPLEIPC 177 #ifndef MAKE_DISTRIBUTION 182 static int PyInitialized = 0;
192 int n = singularMatrix->
rows();
194 unsigned long **longMatrix = 0;
195 longMatrix =
new unsigned long *[n] ;
196 for (
int i = 0 ;
i < n;
i++)
197 longMatrix[
i] =
new unsigned long [n];
199 for (
int r = 0;
r < n;
r++)
200 for (
int c = 0; c < n; c++)
212 longMatrix[
r][c] = (
unsigned long)entryAsInt;
227 if ((
int)polyCoeffs[
i] != 0)
249 const char *sys_cmd=(
char *)(args->
Data());
254 if (strcmp(sys_cmd,
"nblocks") == 0)
276 r = (ring) h->
Data();
283 if(strcmp(sys_cmd,
"version")==0)
291 if(strcmp(sys_cmd,
"cpu")==0)
294 #ifdef _SC_NPROCESSORS_ONLN 295 cpu=sysconf(_SC_NPROCESSORS_ONLN);
296 #elif defined(_SC_NPROCESSORS_CONF) 297 cpu=sysconf(_SC_NPROCESSORS_CONF);
299 res->
data=(
void *)cpu;
306 if(strcmp(sys_cmd,
"sh")==0)
310 WerrorS(
"shell execution is disallowed in restricted mode");
323 if(strcmp(sys_cmd,
"power1")==0)
332 if(strcmp(sys_cmd,
"power2")==0)
337 for(
int i=0;
i<2000;
i++)
342 if(strcmp(sys_cmd,
"power3")==0)
361 res->
data=(
void *)p2000;
381 if(strcmp(sys_cmd,
"uname")==0)
389 if(strcmp(sys_cmd,
"with")==0)
399 #define TEST_FOR(A) if(strcmp(s,A)==0) res->data=(void *)1; else 400 char *
s=(
char *)h->
Data();
413 #ifdef TEST_MAC_ORDER 418 #ifdef HAVE_DYNAMIC_LOADING 441 if (strcmp(sys_cmd,
"browsers")==0)
451 if (strcmp(sys_cmd,
"pid")==0)
454 res->
data=(
void *)(
long) getpid();
459 if (strcmp(sys_cmd,
"getenv")==0)
477 if (strcmp(sys_cmd,
"setenv")==0)
494 WerrorS(
"setenv not supported on this platform");
500 if (strcmp(sys_cmd,
"Singular") == 0)
509 if (strcmp(sys_cmd,
"SingularLib") == 0)
519 if (strstr(sys_cmd,
"--") == sys_cmd)
521 if (strcmp(sys_cmd,
"--") == 0)
529 Werror(
"Unknown option %s", sys_cmd);
530 WerrorS(
"Use 'system(\"--\");' for listing of available options");
545 const char *
r=(
const char*)
feOptSpec[opt].value;
559 WerrorS(
"Need string or int argument to set option value");
562 const char* errormsg;
567 Werror(
"Need string argument to set value of option %s", sys_cmd);
571 if (errormsg !=
NULL)
572 Werror(
"Option '--%s=%d' %s", sys_cmd, (
int) ((
long)h->
Data()), errormsg);
577 if (errormsg !=
NULL)
578 Werror(
"Option '--%s=%s' %s", sys_cmd, (
char*) h->
Data(), errormsg);
585 if (strcmp(sys_cmd,
"HC")==0)
593 if(strcmp(sys_cmd,
"random")==0)
616 if (strcmp(sys_cmd,
"std_syz") == 0)
622 i1=(ideal)h->
CopyD();
628 i2=(int)((
long)h->
Data());
637 if (strcmp(sys_cmd,
"denom_list")==0)
646 if(strcmp(sys_cmd,
"complexNearZero")==0)
653 WerrorS(
"unsupported ground field!");
671 if(strcmp(sys_cmd,
"getPrecDigits")==0)
676 WerrorS(
"unsupported ground field!");
687 if(strcmp(sys_cmd,
"lduDecomp")==0)
695 lduDecomp(aMat, pMat, lMat, dMat, uMat, l, u, prodLU);
706 res->
data = (
char *)L;
716 if(strcmp(sys_cmd,
"lduSolve")==0)
757 Werror(
"first matrix (%d x %d) is not quadratic",
763 Werror(
"second matrix (%d x %d) is not quadratic",
769 Werror(
"third matrix (%d x %d) is not quadratic",
775 Werror(
"third matrix (%d x %d) and fourth matrix (%d x %d) %s",
782 Werror(
"fourth matrix (%d x %d) and vector (%d x 1) do not fit",
787 bVec, xVec, homogSolSpace);
810 if (strcmp(sys_cmd,
"shared") == 0)
812 #ifndef SI_COUNTEDREF_AUTOLOAD 819 else if (strcmp(sys_cmd,
"reference") == 0)
821 #ifndef SI_COUNTEDREF_AUTOLOAD 830 #ifdef HAVE_SIMPLEIPC 831 if (strcmp(sys_cmd,
"semaphore")==0)
844 WerrorS(
"Usage: system(\"semaphore\",<cmd>,int)");
851 if (strcmp(sys_cmd,
"reserve")==0)
859 res->
data=(
void*)(
long)
p;
866 if (strcmp(sys_cmd,
"reservedLink")==0)
876 if (strcmp(sys_cmd,
"install")==0)
889 if (strcmp(sys_cmd,
"newstruct")==0)
895 char *n=(
char*)h->
Data();
902 newstruct_desc desc=(newstruct_desc)bb->data;
906 else Werror(
"'%s' is not a newstruct",n);
908 else Werror(
"'%s' is not a blackbox object",n);
914 if (strcmp(sys_cmd,
"blackbox")==0)
922 if (strcmp(sys_cmd,
"absFact") == 0)
939 l->
m[0].
data=(
void *)f;
941 l->
m[1].
data=(
void *)v;
943 l->
m[2].
data=(
void*) mipos;
945 l->
m[3].
data=(
void*) (
long) n;
955 if (strcmp(sys_cmd,
"LLL") == 0)
978 #ifdef FLINT_VER_2_4_5 979 if (strcmp(sys_cmd,
"LLL_Flint") == 0)
1000 WerrorS(
"matrix,int or bigint,int expected");
1005 if(((
int)((
long)(h->
next->
Data())) != 0) && (
int)((long)(h->
next->
Data()) != 1))
1007 WerrorS(
"int is different from 0, 1");
1032 for(
int i = 1;
i<=m->
rows();
i++)
1037 m = singflint_LLL(m,T);
1050 for(
int i = 1;
i<=m->
rows();
i++)
1052 m = singflint_LLL(m,T);
1072 #ifdef HAVE_SHIFTBBA 1073 if (strcmp(sys_cmd,
"stest") == 0)
1080 int sh=(int)((
long)(h->
Data()));
1082 int uptodeg=(int)((
long)(h->
Data()));
1084 int lVblock=(int)((
long)(h->
Data()));
1094 #ifdef HAVE_SHIFTBBA 1095 if (strcmp(sys_cmd,
"btest") == 0)
1102 int lV=(int)((
long)(h->
Data()));
1112 #ifdef HAVE_SHIFTBBA 1113 if (strcmp(sys_cmd,
"shrinktest") == 0)
1120 int lV=(int)((
long)(h->
Data()));
1134 if(strcmp(sys_cmd,
"pcvLAddL")==0)
1139 if(strcmp(sys_cmd,
"pcvPMulL")==0)
1144 if(strcmp(sys_cmd,
"pcvMinDeg")==0)
1149 if(strcmp(sys_cmd,
"pcvP2CV")==0)
1154 if(strcmp(sys_cmd,
"pcvCV2P")==0)
1159 if(strcmp(sys_cmd,
"pcvDim")==0)
1164 if(strcmp(sys_cmd,
"pcvBasis")==0)
1171 #ifdef HAVE_EIGENVAL 1172 if(strcmp(sys_cmd,
"hessenberg")==0)
1179 #ifdef HAVE_EIGENVAL 1180 if(strcmp(sys_cmd,
"eigenvals")==0)
1187 #ifdef HAVE_EIGENVAL 1188 if(strcmp(sys_cmd,
"rowelim")==0)
1195 #ifdef HAVE_EIGENVAL 1196 if(strcmp(sys_cmd,
"rowcolswap")==0)
1204 if(strcmp(sys_cmd,
"gmsnf")==0)
1206 return gmsNF(res,h);
1211 if(strcmp(sys_cmd,
"contributors") == 0)
1215 "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");
1220 #ifdef HAVE_SPECTRUM 1221 if(strcmp(sys_cmd,
"spectrum") == 0)
1241 if(strcmp(sys_cmd,
"semic") == 0)
1256 if(strcmp(sys_cmd,
"spadd") == 0)
1267 if(strcmp(sys_cmd,
"spmul") == 0)
1279 #define HAVE_SHEAFCOH_TRICKS 1 1281 #ifdef HAVE_SHEAFCOH_TRICKS 1282 if(strcmp(sys_cmd,
"tensorModuleMult")==0)
1288 int m = (int)( (
long)h->
Data() );
1300 if (strcmp(sys_cmd,
"twostd") == 0)
1305 I=(ideal)h->
CopyD();
1319 if (strcmp(sys_cmd,
"bracket") == 0)
1337 if (strcmp(sys_cmd,
"env")==0)
1341 ring
r = (ring)h->
Data();
1348 WerrorS(
"`system(\"env\",<ring>)` expected");
1356 if (strcmp(sys_cmd,
"opp")==0)
1360 ring
r=(ring)h->
Data();
1367 WerrorS(
"`system(\"opp\",<ring>)` expected");
1375 if (strcmp(sys_cmd,
"oppose")==0)
1380 ring Rop = (ring)h->
Data();
1393 WerrorS(
"`system(\"oppose\",<ring>,<poly>)` expected");
1401 #ifdef HAVE_SHIFTBBA 1402 if (strcmp(sys_cmd,
"freegb") == 0)
1407 ideal I=(ideal)h->
CopyD();
1409 int uptodeg=(int)((
long)(h->
Data()));
1411 int lVblock=(int)((
long)(h->
Data()));
1430 if (strcmp(sys_cmd,
"walkNextWeight") == 0)
1437 Werror(
"system(\"walkNextWeight\" ...) intvecs not of length %d\n",
1460 if (strcmp(sys_cmd,
"walkInitials") == 0)
1464 WerrorS(
"system(\"walkInitials\", ideal) expected");
1467 res->
data = (
void*) walkInitials((ideal) h->
Data());
1477 if (strcmp(sys_cmd,
"walkAddIntVec") == 0)
1483 res->
data = (
intvec*) walkAddIntVec(arg1, arg2);
1492 #ifdef MwaklNextWeight 1493 if (strcmp(sys_cmd,
"MwalkNextWeight") == 0)
1500 Werror(
"system(\"MwalkNextWeight\" ...) intvecs not of length %d\n",
1513 #endif //MWalkNextWeight 1517 if(strcmp(sys_cmd,
"Mivdp") == 0)
1521 WerrorS(
"system(\"Mivdp\", int) expected");
1526 Werror(
"system(\"Mivdp\" ...) intvecs not of length %d\n",
1530 int arg1 = (int) ((
long)(h->
Data()));
1540 if(strcmp(sys_cmd,
"Mivlp") == 0)
1544 WerrorS(
"system(\"Mivlp\", int) expected");
1549 Werror(
"system(\"Mivlp\" ...) intvecs not of length %d\n",
1553 int arg1 = (int) ((
long)(h->
Data()));
1564 if(strcmp(sys_cmd,
"MpDiv") == 0)
1581 if(strcmp(sys_cmd,
"MpMult") == 0)
1597 if (strcmp(sys_cmd,
"MivSame") == 0)
1625 if (strcmp(sys_cmd,
"M3ivSame") == 0)
1655 if(strcmp(sys_cmd,
"MwalkInitialForm") == 0)
1661 Werror(
"system \"MwalkInitialForm\"...) intvec not of length %d\n",
1665 ideal
id = (ideal) h->
Data();
1677 if(strcmp(sys_cmd,
"MivMatrixOrder") == 0)
1681 WerrorS(
"system(\"MivMatrixOrder\",intvec) expected");
1694 if(strcmp(sys_cmd,
"MivMatrixOrderdp") == 0)
1698 WerrorS(
"system(\"MivMatrixOrderdp\",intvec) expected");
1701 int arg1 = (int) ((
long)(h->
Data()));
1711 if(strcmp(sys_cmd,
"MPertVectors") == 0)
1715 ideal arg1 = (ideal) h->
Data();
1727 if(strcmp(sys_cmd,
"MPertVectorslp") == 0)
1731 ideal arg1 = (ideal) h->
Data();
1743 if(strcmp(sys_cmd,
"Mfpertvector") == 0)
1747 ideal arg1 = (ideal) h->
Data();
1758 if(strcmp(sys_cmd,
"MivUnit") == 0)
1762 int arg1 = (int) ((
long)(h->
Data()));
1772 if(strcmp(sys_cmd,
"MivWeightOrderlp") == 0)
1786 if(strcmp(sys_cmd,
"MivWeightOrderdp") == 0)
1790 WerrorS(
"system(\"MivWeightOrderdp\",intvec) expected");
1804 if(strcmp(sys_cmd,
"MivMatrixOrderlp") == 0)
1808 WerrorS(
"system(\"MivMatrixOrderlp\",int) expected");
1811 int arg1 = (int) ((
long)(h->
Data()));
1821 if (strcmp(sys_cmd,
"MkInterRedNextWeight") == 0)
1828 Werror(
"system(\"MkInterRedNextWeight\" ...) intvecs not of length %d\n",
1844 #ifdef MPertNextWeight 1845 if (strcmp(sys_cmd,
"MPertNextWeight") == 0)
1851 Werror(
"system(\"MPertNextWeight\" ...) intvecs not of length %d\n",
1856 ideal arg2 = (ideal) h->
next->
Data();
1864 #endif //MPertNextWeight 1868 #ifdef Mivperttarget 1869 if (strcmp(sys_cmd,
"Mivperttarget") == 0)
1873 ideal arg1 = (ideal) h->
Data();
1881 #endif //Mivperttarget 1885 if (strcmp(sys_cmd,
"Mwalk") == 0)
1892 Werror(
"system(\"Mwalk\" ...) intvecs not of length %d\n",
1896 ideal arg1 = (ideal) h->
CopyD();
1902 ideal
result = (ideal)
Mwalk(arg1, arg2, arg3, arg4, arg5, arg6);
1912 if (strcmp(sys_cmd,
"Mwalk") == 0)
1921 Werror(
"system(\"Mwalk\" ...) intvecs not of length %d or %d\n",
1925 ideal arg1 = (ideal) h->
Data();
1929 ideal
result = (ideal)
Mwalk(arg1, arg2, arg3,arg4);
1936 if (strcmp(sys_cmd,
"Mpwalk") == 0)
1943 Werror(
"system(\"Mpwalk\" ...) intvecs not of length %d\n",
currRing->N);
1946 ideal arg1 = (ideal) h->
Data();
1947 int arg2 = (int) (
long) h->
next->
Data();
1954 ideal
result = (ideal)
Mpwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
1964 if (strcmp(sys_cmd,
"Mrwalk") == 0)
1973 Werror(
"system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
1977 ideal arg1 = (ideal) h->
Data();
1984 ideal
result = (ideal)
Mrwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
1993 if (strcmp(sys_cmd,
"MAltwalk1") == 0)
2000 Werror(
"system(\"MAltwalk1\" ...) intvecs not of length %d\n",
2004 ideal arg1 = (ideal) h->
Data();
2005 int arg2 = (int) ((
long)(h->
next->
Data()));
2019 if (strcmp(sys_cmd,
"Mfwalk_alt") == 0)
2026 Werror(
"system(\"Mfwalk\" ...) intvecs not of length %d\n",
2030 ideal arg1 = (ideal) h->
Data();
2034 ideal
result = (ideal) Mfwalk_alt(arg1, arg2, arg3, arg4);
2044 if (strcmp(sys_cmd,
"Mfwalk") == 0)
2051 Werror(
"system(\"Mfwalk\" ...) intvecs not of length %d\n",
2055 ideal arg1 = (ideal) h->
Data();
2060 ideal
result = (ideal)
Mfwalk(arg1, arg2, arg3, arg4, arg5);
2069 if (strcmp(sys_cmd,
"Mfrwalk") == 0)
2086 Werror(
"system(\"Mfrwalk\" ...) intvecs not of length %d or %d\n",
2091 ideal arg1 = (ideal) h->
Data();
2097 ideal
result = (ideal)
Mfrwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2104 if (strcmp(sys_cmd,
"Mprwalk") == 0)
2113 Werror(
"system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
2117 ideal arg1 = (ideal) h->
Data();
2126 ideal
result = (ideal)
Mprwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
2136 if (strcmp(sys_cmd,
"TranMImprovwalk") == 0)
2143 Werror(
"system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2147 ideal arg1 = (ideal) h->
Data();
2160 if (strcmp(sys_cmd,
"MAltwalk2") == 0)
2167 Werror(
"system(\"MAltwalk2\" ...) intvecs not of length %d\n",
2171 ideal arg1 = (ideal) h->
Data();
2183 if (strcmp(sys_cmd,
"TranMImprovwalk") == 0)
2190 Werror(
"system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2194 ideal arg1 = (ideal) h->
Data();
2208 if (strcmp(sys_cmd,
"TranMrImprovwalk") == 0)
2217 WerrorS(
"system(\"TranMrImprovwalk\", ideal, intvec, intvec) expected");
2223 Werror(
"system(\"TranMrImprovwalk\" ...) intvecs not of length %d\n",
currRing->N);
2226 ideal arg1 = (ideal) h->
Data();
2232 ideal
result = (ideal) TranMrImprovwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2242 #ifndef MAKE_DISTRIBUTION 2253 #ifdef HAVE_EXTENDED_SYSTEM 2258 # include <hc_newton.h> 2268 char *sys_cmd=(
char *)(h->
Data());
2271 if (strcmp(sys_cmd,
"syz") == 0)
2288 const char *
s=(
const char *)h->
Data();
2289 if (strcmp(s,
"posInT_EcartFDegpLength")==0)
2291 else if (strcmp(s,
"posInT_FDegpLength")==0)
2293 else if (strcmp(s,
"posInT_pLength")==0)
2295 else if (strcmp(s,
"posInT0")==0)
2297 else if (strcmp(s,
"posInT1")==0)
2299 else if (strcmp(s,
"posInT2")==0)
2301 else if (strcmp(s,
"posInT11")==0)
2303 else if (strcmp(s,
"posInT110")==0)
2305 else if (strcmp(s,
"posInT13")==0)
2307 else if (strcmp(s,
"posInT15")==0)
2309 else if (strcmp(s,
"posInT17")==0)
2311 else if (strcmp(s,
"posInT17_c")==0)
2313 else if (strcmp(s,
"posInT19")==0)
2315 else Print(
"valid posInT:0,1,2,11,110,13,15,17,17_c,19,_EcartFDegpLength,_FDegpLength,_pLength,_EcartpLength\n");
2327 if(strcmp(sys_cmd,
"locNF")==0)
2334 ideal
m=(ideal)h->
Data();
2337 int n=(int)((
long)h->
Data());
2402 if(strcmp(sys_cmd,
"p")==0)
2407 Warn(
"Sorry: not available for release build!");
2413 if(strcmp(sys_cmd,
"setsyzcomp")==0)
2417 int k = (int)(
long)h->
Data();
2425 if(strcmp(sys_cmd,
"r")==0)
2430 Warn(
"Sorry: not available for release build!");
2442 if(strcmp(sys_cmd,
"changeRing")==0)
2446 for (
int i = 1;
i <= varN;
i++)
2449 sprintf(h,
"x%d",
i);
2454 res->
data = (
void*)0L;
2459 if(strcmp(sys_cmd,
"mtrack")==0)
2470 fd = fopen((
char*) h->
Data(),
"w");
2472 Warn(
"Can not open %s for writing og mtrack. Using stdout");
2476 max = (int)(
long)h->
Data();
2481 if (fd !=
NULL) fclose(fd);
2487 if(strcmp(sys_cmd,
"mtrack_all")==0)
2494 fd = fopen((
char*) h->
Data(),
"w");
2496 Warn(
"Can not open %s for writing og mtrack. Using stdout");
2501 if (fd !=
NULL) fclose(fd);
2509 if(strcmp(sys_cmd,
"backtrace")==0)
2517 #if !defined(OM_NDEBUG) 2519 if (strcmp(sys_cmd,
"omMemoryTest")==0)
2523 PrintS(
"\n[om_Info]: \n");
2525 #define OM_PRINT(name) Print(" %-22s : %10ld \n", #name, om_Info . name) 2526 OM_PRINT(MaxBytesSystem);
2527 OM_PRINT(CurrentBytesSystem);
2528 OM_PRINT(MaxBytesSbrk);
2529 OM_PRINT(CurrentBytesSbrk);
2530 OM_PRINT(MaxBytesMmap);
2531 OM_PRINT(CurrentBytesMmap);
2532 OM_PRINT(UsedBytes);
2533 OM_PRINT(AvailBytes);
2534 OM_PRINT(UsedBytesMalloc);
2535 OM_PRINT(AvailBytesMalloc);
2536 OM_PRINT(MaxBytesFromMalloc);
2537 OM_PRINT(CurrentBytesFromMalloc);
2538 OM_PRINT(MaxBytesFromValloc);
2539 OM_PRINT(CurrentBytesFromValloc);
2540 OM_PRINT(UsedBytesFromValloc);
2541 OM_PRINT(AvailBytesFromValloc);
2543 OM_PRINT(UsedPages);
2544 OM_PRINT(AvailPages);
2545 OM_PRINT(MaxRegionsAlloc);
2546 OM_PRINT(CurrentRegionsAlloc);
2551 PrintS(
"\n[om_Opts]: \n");
2552 #define OM_PRINT(format, name) Print(" %-22s : %10" format"\n", #name, om_Opts . name) 2553 OM_PRINT(
"d", MinTrack);
2554 OM_PRINT(
"d", MinCheck);
2555 OM_PRINT(
"d", MaxTrack);
2556 OM_PRINT(
"d", MaxCheck);
2557 OM_PRINT(
"d", Keep);
2558 OM_PRINT(
"d", HowToReportErrors);
2559 OM_PRINT(
"d", MarkAsStatic);
2560 OM_PRINT(
"u", PagesPerRegion);
2561 OM_PRINT(
"p", OutOfMemoryFunc);
2562 OM_PRINT(
"p", MemoryLowFunc);
2563 OM_PRINT(
"p", ErrorHook);
2568 Print(
"\n\n[om_ErrorStatus] : '%s' (%s)\n",
2571 Print(
"[om_InternalErrorStatus]: '%s' (%s)\n",
2584 #if defined(PDEBUG) || defined(PDIV_DEBUG) 2585 if(strcmp(sys_cmd,
"pDivStat")==0)
2595 if(strcmp(sys_cmd,
"alarm")==0)
2602 struct itimerval t,o;
2603 memset(&t,0,
sizeof(t));
2604 t.it_value.tv_sec =(unsigned)((
unsigned long)h->
Data());
2605 setitimer(ITIMER_VIRTUAL,&t,&o);
2615 if(strcmp(sys_cmd,
"red")==0)
2630 if(strcmp(sys_cmd,
"fastcomb")==0)
2638 Warn(
"Wrong types for poly= comb(ideal,poly)");
2651 if(strcmp(sys_cmd,
"comb")==0)
2659 Warn(
"Wrong types for poly= comb(ideal,poly)");
2673 if(strcmp(sys_cmd,
"listall")==0)
2675 void listall(
int showproc);
2685 if(strcmp(sys_cmd,
"proclist")==0)
2687 void piShowProcList();
2695 if(strcmp(sys_cmd,
"newton")==0)
2701 WerrorS(
"system(\"newton\",<poly>,<int>,<int>) expected");
2710 for (i=0;pp!=
NULL;i++)
2737 L->
m[1].
data=(
void *)(
long)r.achse;
2739 L->
m[2].
data=(
void *)(
long)r.deg;
2743 L->
m[3].
data=(
void *)(
long)r.anz_punkte;
2745 int anz = r.anz_punkte;
2748 for (i=0; i<anz*
dim; i++)
2751 L->
m[4].
data=(
void *)v;
2758 (*w)[
i] = r.deg_tab[
i];
2761 while (r.deg_tab[i-1] != -2);
2763 L->
m[5].
data=(
void *)w;
2772 res->
data=(
void *)L;
2795 if (strcmp(sys_cmd,
"minpoly") == 0)
2799 Werror(
"expected exactly one argument: %s",
2800 "a square matrix with number entries");
2810 WerrorS(
"expected exactly one argument: " 2811 "a square matrix with number entries");
2818 res->
data = (
void *)theMinPoly;
2819 for (
int i = 0;
i < n;
i++)
delete[] ml[
i];
2821 delete[] polyCoeffs;
2828 if (strcmp(sys_cmd,
"sdb_flags") == 0)
2836 WerrorS(
"system(\"sdb_flags\",`int`) expected");
2845 if (strcmp(sys_cmd,
"sdb_edit") == 0)
2854 WerrorS(
"system(\"sdb_edit\",`proc`) expected");
2862 #if 0 // for testing only 2863 if (strcmp(sys_cmd,
"GF") == 0)
2880 if (strcmp(sys_cmd,
"svd") == 0)
2895 if (strcmp(sys_cmd,
"DLL") == 0)
2897 typedef void (*Void_Func)();
2898 typedef int (*Int_Func)(int);
2908 if (
f!=
NULL) printf(
"%d\n",
f(i));
2909 else PrintS(
"cannot find PlusDll\n");
2917 else PrintS(
"cannot find TestDll\n");
2924 #ifdef HAVE_RING2TOM 2926 if (strcmp(sys_cmd,
"findZeroPoly")==0)
2936 #ifdef HAVE_VANIDEAL 2937 if (strcmp(sys_cmd,
"createG0")==0)
2962 if (strcmp(sys_cmd,
"redNF_ring")==0)
2967 ideal
G = (ideal) h->
Data();
2975 if (strcmp(sys_cmd,
"hilbroune") == 0)
2980 I=(ideal)h->
CopyD();
2989 if (strcmp(sys_cmd,
"f5")==0)
2998 ideal
G = (ideal) h->
Data();
3002 opt = (int) (
long) h->
Data();
3010 plus = (int) (
long) h->
Data();
3018 termination = (int) (
long) h->
Data();
3024 res->
data=(ideal)
F5main(G,r,opt,plus,termination);
3031 if (strcmp(sys_cmd,
"NF_ring")==0)
3036 ideal
G = (ideal) h->
Data();
3042 if (strcmp(sys_cmd,
"spoly")==0)
3053 if (strcmp(sys_cmd,
"testGB")==0)
3055 ideal I = (ideal) h->
Data();
3057 ideal GI = (ideal) h->
Data();
3066 if ( (strcmp(sys_cmd,
"AltVarStart") == 0) || (strcmp(sys_cmd,
"AltVarEnd") == 0) )
3072 WerrorS(
"`system(\"AltVarStart/End\"[,<ring>])` expected");
3080 if(strcmp(sys_cmd,
"AltVarStart") == 0)
3087 WerrorS(
"`system(\"AltVarStart/End\",<ring>) requires a SCA ring");
3093 #ifdef HAVE_RATGRING 3094 if (strcmp(sys_cmd,
"intratNF") == 0)
3109 I=(ideal)h->
CopyD();
3117 is=(int)((
long)(h->
Data()));
3125 for(k=0; k < id; k++)
3129 Print(
"starting redRat\n");
3147 if (strcmp(sys_cmd,
"ratNF") == 0)
3166 is=(int)((
long)(h->
Data()));
3181 if (strcmp(sys_cmd,
"ratSpoly") == 0)
3199 is=(int)((
long)(h->
Data()));
3213 #endif // HAVE_RATGRING 3215 if (strcmp(sys_cmd,
"ratVar") == 0)
3232 return (start==0)||(end==0)||(start>end);
3236 if (strcmp(sys_cmd,
"unifastmult")==0)
3246 if (strcmp(sys_cmd,
"multifastmult")==0)
3256 if (strcmp(sys_cmd,
"mults")==0)
3263 if (strcmp(sys_cmd,
"fastpower")==0)
3268 int n=(int)((
long)h->
Data());
3274 if (strcmp(sys_cmd,
"normalpower")==0)
3278 int n=(int)((
long)h->
Data());
3284 if (strcmp(sys_cmd,
"MCpower")==0)
3289 int n=(int)((
long)h->
Data());
3295 if (strcmp(sys_cmd,
"bit_subst")==0)
3307 if (strcmp(sys_cmd,
"gcd") == 0)
3325 char *
s=(
char *)h->
Data();
3340 if (strcmp(sys_cmd,
"subring") == 0)
3354 if (strcmp(sys_cmd,
"HNF") == 0)
3375 if (strcmp (sys_cmd,
"probIrredTest") == 0)
3381 double error= atof (s);
3393 if (strcmp(sys_cmd,
"python") == 0)
3398 c=(
const char*)h->
Data();
3399 if (!PyInitialized) {
3447 if(strcmp(sys_cmd,
"GNUmpLoad")==0)
3451 char* filename = (
char*)h->
Data();
3452 FILE*
f = fopen(filename,
"r");
3455 WerrorS(
"invalid file name (in paths use '/')");
3458 mpz_t
m; mpz_init(m);
3459 mpz_inp_str(m, f, 10);
3463 res->
data = (
void*)n;
3468 WerrorS(
"expected valid file name as a string");
3480 if(strcmp(sys_cmd,
"intvecMatchingSegments")==0)
3489 int validEntries = 0;
3490 for (
int k = 0;
k <= ivec->
rows() - jvec->
rows();
k++)
3492 if (memcmp(&(*ivec)[
k], &(*jvec)[0],
3493 sizeof(
int) * jvec->
rows()) == 0)
3495 if (validEntries == 0)
3499 r->
resize(validEntries + 1);
3500 (*r)[validEntries] = k + 1;
3506 res->
data = (
void*)r;
3511 WerrorS(
"expected two non-empty intvecs as arguments");
3522 if(strcmp(sys_cmd,
"intvecOverlap")==0)
3530 int ir = ivec->
rows();
int jr = jvec->
rows();
3531 int r = jr;
if (ir < jr) r = ir;
3532 while ((r >= 1) && (memcmp(&(*ivec)[ir - r], &(*jvec)[0],
3533 sizeof(
int) * r) != 0))
3536 res->
data = (
void*)(
long)
r;
3541 WerrorS(
"expected two non-empty intvecs as arguments");
3547 if(strcmp(sys_cmd,
"henselfactors")==0)
3560 int xIndex = (int)(
long)h->
Data();
3561 int yIndex = (int)(
long)h->
next->
Data();
3573 res->
data = (
char *)L;
3578 WerrorS(
"expected argument list (int, int, poly, poly, poly, int)");
3584 if(strcmp(sys_cmd,
"neworder")==0)
3598 if (strcmp(sys_cmd,
"astep") == 0)
3603 I=(ideal)h->
CopyD();
3616 if (strcmp(sys_cmd,
"PrintMat") == 0)
3626 a=(int)((
long)(h->
Data()));
3631 b=(int)((
long)(h->
Data()));
3646 metric=(int)((
long)(h->
Data()));
3657 if(strcmp(sys_cmd,
"NCUseExtensions")==0)
3670 if(strcmp(sys_cmd,
"NCGetType")==0)
3676 res->
data=(
void *)(-1L);
3683 if(strcmp(sys_cmd,
"ForceSCA")==0)
3690 b = (int)((
long)(h->
Data()));
3696 e = (int)((
long)(h->
Data()));
3707 if(strcmp(sys_cmd,
"ForceNewNCMultiplication")==0)
3719 if(strcmp(sys_cmd,
"ForceNewOldNCMultiplication")==0)
3731 if(strcmp(sys_cmd,
"test64")==0)
3747 Print(
"SIZEOF_LONG=%d\n",SIZEOF_LONG);
3753 if(strcmp(sys_cmd,
"cache_chinrem")==0)
3756 Print(
"caching inverse in chines remainder:%d\n",n_SwitchChinRem);
3758 n_SwitchChinRem=(int)(
long)h->
Data();
3764 if(strcmp(sys_cmd,
"LU")==0)
3774 res->
data=(
char*)bb;
3779 WerrorS(
"system(\"LU\",<cmatrix>) expected");
3791 #endif // HAVE_EXTENDED_SYSTEM
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
int posInT_pLength(const TSet set, const int length, LObject &p)
const CanonicalForm int s
This file provides miscellaneous functionality.
poly pFastPower(poly f, int n, ring r)
intvec * MivMatrixOrder(intvec *iv)
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
void p_DebugPrint(poly p, const ring r)
void factoryseed(int s)
random seed initializer
Class used for (list of) interpreter objects.
const char * omError2String(omError_t error)
ring rSubring(ring org_ring, sleftv *rv)
void resize(int new_length)
int posInT2(const TSet set, const int length, LObject &p)
matrix singntl_LLL(matrix m, const ring s)
intvec * Mfpertvector(ideal G, intvec *ivtarget)
static void * feOptValue(feOptIndex opt)
matrix evRowElim(matrix M, int i, int j, int k)
ideal Mpwalk(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight, int nP, int reduction, int printout)
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...
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Compatiblity layer for legacy polynomial operations (over currRing)
int posInT1(const TSet set, const int length, LObject &p)
intvec * MivWeightOrderlp(intvec *ivstart)
short * iv2array(intvec *iv, const ring R)
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
number n_convFactoryNSingN(const CanonicalForm n, const coeffs r)
void sdb_edit(procinfo *pi)
static char * feResource(feResourceConfig config, int warn)
This file is work in progress and currently not part of the official Singular.
lists pcvPMulL(poly p, lists l1)
static const int SW_USE_EZGCD_P
set to 1 to use EZGCD over F_q
int setNCExtensions(int iMask)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
#define omFreeSize(addr, size)
poly pFastPowerMC(poly f, int n, ring r)
omError_t om_InternalErrorStatus
poly nc_rat_ReduceSpolyNew(const poly p1, poly p2, int ishift, const ring r)
ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing)
BOOLEAN spectrumProc(leftv result, leftv first)
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
int MivSame(intvec *u, intvec *v)
intvec * MivWeightOrderdp(intvec *ivstart)
static coordinates * points
void * dynl_sym(void *handle, const char *symbol)
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
const char * feSetOptValue(feOptIndex opt, char *optarg)
void WerrorS(const char *s)
gmp_complex numbers based on
bool complexNearZero(gmp_complex *c, int digits)
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...
int testGB(ideal I, ideal GI)
int posInT15(const TSet set, const int length, LObject &p)
static bool rIsPluralRing(const ring r)
we must always have this test!
CanonicalForm n_convSingNFactoryN(number n, BOOLEAN setChar, const coeffs r)
static int pLength(poly a)
matrix evSwap(matrix M, int i, int j)
int posInT0(const TSet, const int length, LObject &)
void * dynl_open(char *filename)
idhdl get(const char *s, int lev)
intvec * MPertVectorslp(ideal G, intvec *ivtarget, int pdeg)
static poly fglmNewLinearCombination(ideal source, poly monset)
void printBlackboxTypes()
list all defined type (for debugging)
void feStringAppendBrowsers(int warn)
ideal Mfwalk(ideal G, intvec *ivstart, intvec *ivtarget, int reduction, int printout)
matrix mp_Transp(matrix a, const ring R)
poly p_Shrink(poly p, int lV, const ring r)
bool sca_Force(ring rGR, int b, int e)
unsigned long * computeMinimalPolynomial(unsigned long **matrix, unsigned n, unsigned long p)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
#define pGetExp(p, i)
Exponent.
int posInT11(const TSet set, const int length, LObject &p)
static int rBlocks(ring r)
int posInT17_c(const TSet set, const int length, LObject &p)
Coefficient rings, fields and other domains suitable for Singular polynomials.
ideal MAltwalk1(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight)
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 ...
int pcvDim(int d0, int d1)
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...
matrix nc_PrintMat(int a, int b, ring r, int metric)
returns matrix with the info on noncomm multiplication
static int max(int a, int b)
void newstructShow(newstruct_desc d)
poly uni_subst_bits(poly outer_uni, poly inner_multi, ring r)
poly multifastmult(poly f, poly g, ring r)
void StringSetS(const char *st)
int M3ivSame(intvec *temp, intvec *u, intvec *v)
poly pLPshift(poly p, int sh, int uptodeg, int lV)
const char feNotImplemented[]
struct fe_option feOptSpec[]
const char * omError2Serror(omError_t error)
intvec * MwalkNextWeight(intvec *curr_weight, intvec *target_weight, ideal G)
ideal Mwalk(ideal Go, intvec *orig_M, intvec *target_M, ring baseRing, int reduction, int printout)
intvec * MPertNextWeight(intvec *iva, ideal G, int deg)
static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
conversion of a GMP integer to number
int simpleipc_cmd(char *cmd, int id, int v)
poly nc_rat_CreateSpoly(poly pp1, poly pp2, int ishift, const ring r)
poly pcvCV2P(poly cv, int d0, int d1)
BOOLEAN assumeStdFlag(leftv h)
intvec * Mivperttarget(ideal G, int ndeg)
void PrintS(const char *s)
BOOLEAN spectrumfProc(leftv result, leftv first)
lists pcvLAddL(lists l1, lists l2)
int pcvBasis(lists b, int i, poly m, int d, int n)
int posInT17(const TSet set, const int length, LObject &p)
static const int SW_USE_CHINREM_GCD
set to 1 to use modular gcd over Z
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
matrix singntl_HNF(matrix m, const ring s)
static short scaFirstAltVar(ring r)
poly ringRedNF(poly f, ideal G, ring r)
ideal freegb(ideal I, int uptodeg, int lVblock)
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
int ssiReservePort(int clients)
poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing)
static BOOLEAN rField_is_long_C(const ring r)
void rSetSyzComp(int k, const ring r)
ideal Approx_Step(ideal L)
Ann: ???
#define BIMATELEM(M, I, J)
poly plain_spoly(poly f, poly g)
INLINE_THIS void Init(int l=0)
matrix mpNew(int r, int c)
create a r x c zero-matrix
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
int pLastVblock(poly p, int lV)
const Variable & v
< [in] a sqrfree bivariate poly
matrix evHessenberg(matrix M)
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
matrix mp_InitI(int r, int c, int v, const ring R)
make it a v * unit matrix
lists evEigenvals(matrix M)
static BOOLEAN rField_is_Ring(const ring r)
CanonicalForm convSingPFactoryP(poly p, const ring r)
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
BOOLEAN semicProc(leftv res, leftv u, leftv v)
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...
ideal TranMImprovwalk(ideal G, intvec *curr_weight, intvec *target_tmp, int nP)
int probIrredTest(const CanonicalForm &F, double error)
given some error probIrredTest detects irreducibility or reducibility of F with confidence level 1-er...
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 (...
int posInT110(const TSet set, const int length, LObject &p)
static const int SW_USE_QGCD
set to 1 to use Encarnacion GCD over Q(a)
coeffs basecoeffs() const
static BOOLEAN rField_is_long_R(const ring r)
static const int SW_USE_EZGCD
set to 1 to use EZGCD over Z
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
static short scaLastAltVar(ring r)
intvec * MivMatrixOrderdp(int nV)
static bool rIsSCA(const ring r)
BOOLEAN ncInitSpecialPairMultiplication(ring r)
ideal MAltwalk2(ideal Go, intvec *curr_weight, intvec *target_weight)
ideal Mrwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int pert_deg, int reduction, int printout)
static void p_Setm(poly p, const ring r)
CFList int bool & irred
[in,out] Is A irreducible?
poly pcvP2CV(poly p, int d0, int d1)
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
#define omPrintCurrentBackTrace(fd)
static nc_type & ncRingType(nc_struct *p)
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
int redRat(poly *h, poly *reducer, int *red_length, int rl, int ishift, ring r)
#define pLmDeleteAndNext(p)
like pLmDelete, returns pNext(p)
void pPrintDivisbleByStat()
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
ideal idXXX(ideal h1, int k)
ideal singclap_absFactorize(poly f, ideal &mipos, intvec **exps, int &numFactors, const ring r)
void omPrintUsedTrackAddrs(FILE *fd, int max_frames)
BOOLEAN newstruct_set_proc(const char *bbname, const char *func, int args, procinfov pr)
void omMarkAsStaticAddr(void *addr)
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)
void omPrintUsedAddrs(FILE *fd, int max_frames)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
int posInT19(const TSet set, const int length, LObject &p)
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
lists gmsNF(ideal p, ideal g, matrix B, int D, int K)
ideal id_Vec2Ideal(poly vec, const ring R)
feOptIndex feGetOptIndex(const char *name)
void countedref_reference_load()
Initialize blackbox types 'reference' and 'shared', or both.
static poly p_Add_q(poly p, poly q, const ring r)
char * singclap_neworder(ideal I, const ring r)
poly ringNF(poly f, ideal G, ring r)
ideal MwalkInitialForm(ideal G, intvec *ivw)
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
ideal Mfrwalk(ideal G, intvec *ivstart, intvec *ivtarget, int weight_rad, int reduction, int printout)
#define IMATELEM(M, I, J)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
void Werror(const char *fmt,...)
intvec * MivMatrixOrderlp(int nV)
void countedref_shared_load()
int posInT13(const TSet set, const int length, LObject &p)
poly unifastmult(poly f, poly g, ring r)
static poly fglmLinearCombination(ideal source, poly monset)
#define pCopy(p)
return a copy of the poly
#define MATELEM(mat, i, j)
void n_Print(number &a, const coeffs r)
print a number (BEWARE of string buffers!) mostly for debugging
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
ideal twostd(ideal I)
Compute two-sided GB:
ideal F5main(ideal id, ring r, int opt, int plus, int termination)