19#include "ccluster/ccluster.h"
24#ifdef TIME_WITH_SYS_TIME
26# ifdef HAVE_SYS_TIME_H
30# ifdef HAVE_SYS_TIME_H
36#ifdef HAVE_SYS_TIMES_H
140#ifndef MAKE_DISTRIBUTION
141#define HAVE_EXTENDED_SYSTEM 1
166#ifndef MAKE_DISTRIBUTION
178 int n = singularMatrix->
rows();
180 unsigned long **longMatrix = 0;
181 longMatrix =
new unsigned long *[n] ;
182 for (
int i = 0 ;
i < n;
i++)
183 longMatrix[
i] =
new unsigned long [n];
185 for (
int r = 0; r < n; r++)
186 for (
int c = 0; c < n; c++)
188 poly
p=
MATELEM(singularMatrix, r + 1, c + 1);
198 longMatrix[r][c] = (
unsigned long)entryAsInt;
213 if ((
int)polyCoeffs[
i] != 0)
234 const char *sys_cmd=(
char *)(args->
Data());
239 if (strcmp(sys_cmd,
"nblocks") == 0)
261 r = (ring)
h->Data();
268 if(strcmp(sys_cmd,
"version")==0)
276 if(strcmp(sys_cmd,
"alarm")==0)
283 struct itimerval t,o;
284 memset(&t,0,
sizeof(t));
285 t.it_value.tv_sec =(unsigned)((
unsigned long)
h->Data());
286 setitimer(ITIMER_VIRTUAL,&t,&o);
294 if(strcmp(sys_cmd,
"content")==0)
299 poly
p=(poly)
h->CopyD();
313 if(strcmp(sys_cmd,
"cpu")==0)
317 #ifdef _SC_NPROCESSORS_ONLN
318 cpu=sysconf(_SC_NPROCESSORS_ONLN);
319 #elif defined(_SC_NPROCESSORS_CONF)
320 cpu=sysconf(_SC_NPROCESSORS_CONF);
322 res->data=(
void *)cpu;
331 if(strcmp(sys_cmd,
"executable")==0)
346 if(strcmp(sys_cmd,
"flatten")==0)
359 if(strcmp(sys_cmd,
"unflatten")==0)
372 if(strcmp(sys_cmd,
"neworder")==0)
386 if(strcmp(sys_cmd,
"nc_hilb") == 0)
394 i = (ideal)
h->Data();
397 WerrorS(
"nc_Hilb:ideal expected");
402 lV = (int)(
long)
h->Data();
405 WerrorS(
"nc_Hilb:int expected");
411 if((
int)(
long)
h->Data() == 1)
413 else if((
int)(
long)
h->Data() == 2)
418 trunDegHs = (int)(
long)
h->Data();
423 WerrorS(
"nc_Hilb:int 1,2, total degree for the truncation, and a string for printing the details are expected");
432 if(strcmp(sys_cmd,
"verifyGB")==0)
436 WerrorS(
"system(\"verifyGB\",<ideal>,..) expects a commutative ring");
442 Werror(
"expected system(\"verifyGB\",<ideal/module>), found <%s>",
Tok2Cmdname(
h->Typ()));
445 ideal F=(ideal)
h->Data();
458 if(strcmp(sys_cmd,
"rcolon") == 0)
463 ideal
i = (ideal)
h->Data();
465 poly
w=(poly)
h->Data();
467 int lV = (int)(
long)
h->Data();
478 if(strcmp(sys_cmd,
"sh")==0)
482 WerrorS(
"shell execution is disallowed in restricted mode");
486 if (
h==
NULL)
res->data = (
void *)(
long) system(
"sh");
488 res->data = (
void*)(
long) system((
char*)(
h->Data()));
495 if(strcmp(sys_cmd,
"reduce_bound")==0)
505 p = (poly)
h->CopyD();
509 pid = (ideal)
h->CopyD();
514 ideal q = (ideal)
h->next->CopyD();
515 int bound = (int)(
long)
h->next->next->Data();
524 if(strcmp(sys_cmd,
"uname")==0)
532 if(strcmp(sys_cmd,
"with")==0)
542 #define TEST_FOR(A) if(strcmp(s,A)==0) res->data=(void *)1; else
543 char *
s=(
char *)
h->Data();
556 #ifdef TEST_MAC_ORDER
561 #ifdef HAVE_DYNAMIC_LOADING
584 if (strcmp(sys_cmd,
"browsers")==0)
594 if (strcmp(sys_cmd,
"pid")==0)
597 res->data=(
void *)(
long) getpid();
602 if (strcmp(sys_cmd,
"getenv")==0)
607 const char *r=
getenv((
char *)
h->Data());
620 if (strcmp(sys_cmd,
"setenv")==0)
627 setenv((
char *)
h->Data(), (
char *)
h->next->Data(), 1);
637 WerrorS(
"setenv not supported on this platform");
643 if (strcmp(sys_cmd,
"Singular") == 0)
652 if (strcmp(sys_cmd,
"SingularLib") == 0)
661 if (strcmp(sys_cmd,
"SingularBin") == 0)
665 if (r ==
NULL) r=
"/usr/local";
668 #define SINGULAR_PROCS_DIR "/libexec/singular/MOD"
671 if ((strstr(r,
".libs/..")==
NULL)
672 &&(strstr(r,
"Singular/..")==
NULL))
676 if (access(
s,X_OK)==0)
683 strcpy(
s,LIBEXEC_DIR);
684 if (access(
s,X_OK)==0)
707 res->data = (
void*)
s;
712 if (strstr(sys_cmd,
"--") == sys_cmd)
714 if (strcmp(sys_cmd,
"--") == 0)
722 Werror(
"Unknown option %s", sys_cmd);
723 WerrorS(
"Use 'system(\"--\");' for listing of available options");
738 const char *r=(
const char*)
feOptSpec[opt].value;
752 WerrorS(
"Need string or int argument to set option value");
755 const char* errormsg;
760 Werror(
"Need string argument to set value of option %s", sys_cmd);
764 if (errormsg !=
NULL)
765 Werror(
"Option '--%s=%d' %s", sys_cmd, (
int) ((
long)
h->Data()), errormsg);
770 if (errormsg !=
NULL)
771 Werror(
"Option '--%s=%s' %s", sys_cmd, (
char*)
h->Data(), errormsg);
778 if (strcmp(sys_cmd,
"HC")==0)
786 if(strcmp(sys_cmd,
"random")==0)
809 if (strcmp(sys_cmd,
"denom_list")==0)
818 if(strcmp(sys_cmd,
"complexNearZero")==0)
825 WerrorS(
"unsupported ground field!");
832 (int)((
long)(
h->next->Data())));
843 if(strcmp(sys_cmd,
"getPrecDigits")==0)
848 WerrorS(
"unsupported ground field!");
859 if(strcmp(sys_cmd,
"lduDecomp")==0)
866 poly
l; poly u; poly prodLU;
867 lduDecomp(aMat, pMat, lMat, dMat, uMat,
l, u, prodLU);
878 res->data = (
char *)L;
888 if(strcmp(sys_cmd,
"lduSolve")==0)
922 poly
l = (poly)
h->next->next->next->next->Data();
923 poly u = (poly)
h->next->next->next->next->next->Data();
924 poly lTimesU = (poly)
h->next->next->next->next->next->next->Data();
925 matrix bVec = (
matrix)
h->next->next->next->next->next->next->next->Data();
929 Werror(
"first matrix (%d x %d) is not quadratic",
935 Werror(
"second matrix (%d x %d) is not quadratic",
941 Werror(
"third matrix (%d x %d) is not quadratic",
947 Werror(
"third matrix (%d x %d) and fourth matrix (%d x %d) %s",
954 Werror(
"fourth matrix (%d x %d) and vector (%d x 1) do not fit",
959 bVec, xVec, homogSolSpace);
982 if (strcmp(sys_cmd,
"shared") == 0)
984 #ifndef SI_COUNTEDREF_AUTOLOAD
991 else if (strcmp(sys_cmd,
"reference") == 0)
993 #ifndef SI_COUNTEDREF_AUTOLOAD
1002#ifdef HAVE_SIMPLEIPC
1003 if (strcmp(sys_cmd,
"semaphore")==0)
1008 if ((
h->next->next!=
NULL)&& (
h->next->next->Typ()==
INT_CMD))
1009 v=(int)(
long)
h->next->next->Data();
1016 WerrorS(
"Usage: system(\"semaphore\",<cmd>,int)");
1023 if (strcmp(sys_cmd,
"reserve")==0)
1030 res->data=(
void*)(
long)
p;
1037 if (strcmp(sys_cmd,
"reservedLink")==0)
1046 if (strcmp(sys_cmd,
"install")==0)
1052 (
int)(
long)
h->next->next->next->Data(),
1059 if (strcmp(sys_cmd,
"newstruct")==0)
1065 char *n=(
char*)
h->Data();
1072 newstruct_desc desc=(newstruct_desc)bb->data;
1076 else Werror(
"'%s' is not a newstruct",n);
1078 else Werror(
"'%s' is not a blackbox object",n);
1084 if (strcmp(sys_cmd,
"blackbox")==0)
1091 #if defined(HAVE_FLINT) || defined(HAVE_NTL)
1092 if (strcmp(sys_cmd,
"absFact") == 0)
1109 l->m[0].data=(
void *)
f;
1111 l->m[1].data=(
void *)
v;
1113 l->m[2].data=(
void*) mipos;
1115 l->m[3].data=(
void*) (
long) n;
1116 res->data=(
void *)
l;
1125 if (strcmp(sys_cmd,
"LLL") == 0)
1148 #if __FLINT_RELEASE >= 20500
1149 if (strcmp(sys_cmd,
"LLL_Flint") == 0)
1170 WerrorS(
"matrix,int or bigint,int expected");
1175 if(((
int)((
long)(
h->next->Data())) != 0) && (
int)((
long)(
h->next->Data()) != 1))
1177 WerrorS(
"int is different from 0, 1");
1181 if((
long)(
h->next->Data()) == 0)
1196 if((
long)(
h->next->Data()) == 1)
1202 for(
int i = 1;
i<=
m->rows();
i++)
1220 for(
int i = 1;
i<=
m->rows();
i++)
1242 #if defined(HAVE_FLINT) || defined(HAVE_NTL)
1243 if(strcmp(sys_cmd,
"rref")==0)
1250 #if defined(HAVE_FLINT)
1252 #elif defined(HAVE_NTL)
1260 ideal
M=(ideal)
h->Data();
1261 #if defined(HAVE_FLINT)
1263 #elif defined(HAVE_NTL)
1271 WerrorS(
"expected system(\"rref\",<matrix>/<smatrix>)");
1279 if(strcmp(sys_cmd,
"pcvLAddL")==0)
1284 if(strcmp(sys_cmd,
"pcvPMulL")==0)
1289 if(strcmp(sys_cmd,
"pcvMinDeg")==0)
1294 if(strcmp(sys_cmd,
"pcvP2CV")==0)
1299 if(strcmp(sys_cmd,
"pcvCV2P")==0)
1304 if(strcmp(sys_cmd,
"pcvDim")==0)
1309 if(strcmp(sys_cmd,
"pcvBasis")==0)
1316 #ifdef HAVE_EIGENVAL
1317 if(strcmp(sys_cmd,
"hessenberg")==0)
1324 #ifdef HAVE_EIGENVAL
1325 if(strcmp(sys_cmd,
"eigenvals")==0)
1332 #ifdef HAVE_EIGENVAL
1333 if(strcmp(sys_cmd,
"rowelim")==0)
1340 #ifdef HAVE_EIGENVAL
1341 if(strcmp(sys_cmd,
"rowcolswap")==0)
1349 if(strcmp(sys_cmd,
"gmsnf")==0)
1356 if(strcmp(sys_cmd,
"contributors") == 0)
1360 "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");
1365 #ifdef HAVE_SPECTRUM
1366 if(strcmp(sys_cmd,
"spectrum") == 0)
1380 if(((
long)
h->next->Data())==1L)
1386 if(strcmp(sys_cmd,
"semic") == 0)
1392 if (
h->next->next==
NULL)
1394 else if (
h->next->next->Typ()==
INT_CMD)
1401 if(strcmp(sys_cmd,
"spadd") == 0)
1412 if(strcmp(sys_cmd,
"spmul") == 0)
1424 #define HAVE_SHEAFCOH_TRICKS 1
1426 #ifdef HAVE_SHEAFCOH_TRICKS
1427 if(strcmp(sys_cmd,
"tensorModuleMult")==0)
1433 int m = (int)( (
long)
h->Data() );
1434 ideal
M = (ideal)
h->next->Data();
1445 if (strcmp(sys_cmd,
"twostd") == 0)
1450 I=(ideal)
h->CopyD();
1464 if (strcmp(sys_cmd,
"bracket") == 0)
1469 poly
p=(poly)
h->CopyD();
1471 poly q=(poly)
h->Data();
1482 if (strcmp(sys_cmd,
"env")==0)
1486 ring r = (ring)
h->Data();
1493 WerrorS(
"`system(\"env\",<ring>)` expected");
1501 if (strcmp(sys_cmd,
"opp")==0)
1505 ring r=(ring)
h->Data();
1512 WerrorS(
"`system(\"opp\",<ring>)` expected");
1520 if (strcmp(sys_cmd,
"oppose")==0)
1523 && (
h->next!=
NULL))
1525 ring Rop = (ring)
h->Data();
1538 WerrorS(
"`system(\"oppose\",<ring>,<poly>)` expected");
1545 if(strcmp(sys_cmd,
"sat")==0)
1547 ideal I= (ideal)
h->Data();
1548 ideal J=(ideal)
h->next->Data();
1561 if (strcmp(sys_cmd,
"walkNextWeight") == 0)
1568 Werror(
"system(\"walkNextWeight\" ...) intvecs not of length %d\n",
1572 res->data = (
void*) walkNextWeight(((
intvec*)
h->Data()),
1574 (ideal)
h->next->next->Data());
1575 if (
res->data ==
NULL ||
res->data == (
void*) 1L)
1591 if (strcmp(sys_cmd,
"walkInitials") == 0)
1595 WerrorS(
"system(\"walkInitials\", ideal) expected");
1598 res->data = (
void*) walkInitials((ideal)
h->Data());
1608 if (strcmp(sys_cmd,
"walkAddIntVec") == 0)
1614 res->data = (
intvec*) walkAddIntVec(arg1, arg2);
1623 #ifdef MwaklNextWeight
1624 if (strcmp(sys_cmd,
"MwalkNextWeight") == 0)
1631 Werror(
"system(\"MwalkNextWeight\" ...) intvecs not of length %d\n",
1637 ideal arg3 = (ideal)
h->next->next->Data();
1648 if(strcmp(sys_cmd,
"Mivdp") == 0)
1652 WerrorS(
"system(\"Mivdp\", int) expected");
1655 if ((
int) ((
long)(
h->Data())) !=
currRing->N)
1657 Werror(
"system(\"Mivdp\" ...) intvecs not of length %d\n",
1661 int arg1 = (int) ((
long)(
h->Data()));
1671 if(strcmp(sys_cmd,
"Mivlp") == 0)
1675 WerrorS(
"system(\"Mivlp\", int) expected");
1678 if ((
int) ((
long)(
h->Data())) !=
currRing->N)
1680 Werror(
"system(\"Mivlp\" ...) intvecs not of length %d\n",
1684 int arg1 = (int) ((
long)(
h->Data()));
1695 if(strcmp(sys_cmd,
"MpDiv") == 0)
1699 poly arg1 = (poly)
h->Data();
1700 poly arg2 = (poly)
h->next->Data();
1701 poly
result = MpDiv(arg1, arg2);
1712 if(strcmp(sys_cmd,
"MpMult") == 0)
1716 poly arg1 = (poly)
h->Data();
1717 poly arg2 = (poly)
h->next->Data();
1718 poly
result = MpMult(arg1, arg2);
1728 if (strcmp(sys_cmd,
"MivSame") == 0)
1749 res->data = (
void*)(
long)
MivSame(arg1, arg2);
1756 if (strcmp(sys_cmd,
"M3ivSame") == 0)
1779 res->data = (
void*)(
long)
M3ivSame(arg1, arg2, arg3);
1786 if(strcmp(sys_cmd,
"MwalkInitialForm") == 0)
1792 Werror(
"system \"MwalkInitialForm\"...) intvec not of length %d\n",
1796 ideal
id = (ideal)
h->Data();
1808 if(strcmp(sys_cmd,
"MivMatrixOrder") == 0)
1812 WerrorS(
"system(\"MivMatrixOrder\",intvec) expected");
1825 if(strcmp(sys_cmd,
"MivMatrixOrderdp") == 0)
1829 WerrorS(
"system(\"MivMatrixOrderdp\",intvec) expected");
1832 int arg1 = (int) ((
long)(
h->Data()));
1842 if(strcmp(sys_cmd,
"MPertVectors") == 0)
1846 ideal arg1 = (ideal)
h->Data();
1848 int arg3 = (int) ((
long)(
h->next->next->Data()));
1858 if(strcmp(sys_cmd,
"MPertVectorslp") == 0)
1862 ideal arg1 = (ideal)
h->Data();
1864 int arg3 = (int) ((
long)(
h->next->next->Data()));
1874 if(strcmp(sys_cmd,
"Mfpertvector") == 0)
1878 ideal arg1 = (ideal)
h->Data();
1889 if(strcmp(sys_cmd,
"MivUnit") == 0)
1893 int arg1 = (int) ((
long)(
h->Data()));
1903 if(strcmp(sys_cmd,
"MivWeightOrderlp") == 0)
1917 if(strcmp(sys_cmd,
"MivWeightOrderdp") == 0)
1921 WerrorS(
"system(\"MivWeightOrderdp\",intvec) expected");
1935 if(strcmp(sys_cmd,
"MivMatrixOrderlp") == 0)
1939 WerrorS(
"system(\"MivMatrixOrderlp\",int) expected");
1942 int arg1 = (int) ((
long)(
h->Data()));
1952 if (strcmp(sys_cmd,
"MkInterRedNextWeight") == 0)
1959 Werror(
"system(\"MkInterRedNextWeight\" ...) intvecs not of length %d\n",
1965 ideal arg3 = (ideal)
h->next->next->Data();
1975 #ifdef MPertNextWeight
1976 if (strcmp(sys_cmd,
"MPertNextWeight") == 0)
1982 Werror(
"system(\"MPertNextWeight\" ...) intvecs not of length %d\n",
1987 ideal arg2 = (ideal)
h->next->Data();
1988 int arg3 = (int)
h->next->next->Data();
1999 #ifdef Mivperttarget
2000 if (strcmp(sys_cmd,
"Mivperttarget") == 0)
2004 ideal arg1 = (ideal)
h->Data();
2005 int arg2 = (int)
h->next->Data();
2016 if (strcmp(sys_cmd,
"Mwalk") == 0)
2023 Werror(
"system(\"Mwalk\" ...) intvecs not of length %d\n",
2027 ideal arg1 = (ideal)
h->CopyD();
2030 ring arg4 = (ring)
h->next->next->next->Data();
2031 int arg5 = (int) (
long)
h->next->next->next->next->Data();
2032 int arg6 = (int) (
long)
h->next->next->next->next->next->Data();
2033 ideal
result = (ideal)
Mwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2043 if (strcmp(sys_cmd,
"Mwalk") == 0)
2052 Werror(
"system(\"Mwalk\" ...) intvecs not of length %d or %d\n",
2056 ideal arg1 = (ideal)
h->Data();
2059 ring arg4 = (ring)
h->next->next->next->Data();
2060 ideal
result = (ideal)
Mwalk(arg1, arg2, arg3,arg4);
2067 if (strcmp(sys_cmd,
"Mpwalk") == 0)
2074 Werror(
"system(\"Mpwalk\" ...) intvecs not of length %d\n",
currRing->N);
2077 ideal arg1 = (ideal)
h->Data();
2078 int arg2 = (int) (
long)
h->next->Data();
2079 int arg3 = (int) (
long)
h->next->next->Data();
2082 int arg6 = (int) (
long)
h->next->next->next->next->next->Data();
2083 int arg7 = (int) (
long)
h->next->next->next->next->next->next->Data();
2084 int arg8 = (int) (
long)
h->next->next->next->next->next->next->next->Data();
2085 ideal
result = (ideal)
Mpwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
2095 if (strcmp(sys_cmd,
"Mrwalk") == 0)
2104 Werror(
"system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
2108 ideal arg1 = (ideal)
h->Data();
2111 int arg4 = (int)(
long)
h->next->next->next->Data();
2112 int arg5 = (int)(
long)
h->next->next->next->next->Data();
2113 int arg6 = (int)(
long)
h->next->next->next->next->next->Data();
2114 int arg7 = (int)(
long)
h->next->next->next->next->next->next->Data();
2115 ideal
result = (ideal)
Mrwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
2124 if (strcmp(sys_cmd,
"MAltwalk1") == 0)
2131 Werror(
"system(\"MAltwalk1\" ...) intvecs not of length %d\n",
2135 ideal arg1 = (ideal)
h->Data();
2136 int arg2 = (int) ((
long)(
h->next->Data()));
2137 int arg3 = (int) ((
long)(
h->next->next->Data()));
2150 if (strcmp(sys_cmd,
"Mfwalk_alt") == 0)
2157 Werror(
"system(\"Mfwalk\" ...) intvecs not of length %d\n",
2161 ideal arg1 = (ideal)
h->Data();
2164 int arg4 = (int)
h->next->next->next->Data();
2165 ideal
result = (ideal) Mfwalk_alt(arg1, arg2, arg3, arg4);
2175 if (strcmp(sys_cmd,
"Mfwalk") == 0)
2182 Werror(
"system(\"Mfwalk\" ...) intvecs not of length %d\n",
2186 ideal arg1 = (ideal)
h->Data();
2189 int arg4 = (int)(
long)
h->next->next->next->Data();
2190 int arg5 = (int)(
long)
h->next->next->next->next->Data();
2191 ideal
result = (ideal)
Mfwalk(arg1, arg2, arg3, arg4, arg5);
2200 if (strcmp(sys_cmd,
"Mfrwalk") == 0)
2217 Werror(
"system(\"Mfrwalk\" ...) intvecs not of length %d or %d\n",
2222 ideal arg1 = (ideal)
h->Data();
2225 int arg4 = (int)(
long)
h->next->next->next->Data();
2226 int arg5 = (int)(
long)
h->next->next->next->next->Data();
2227 int arg6 = (int)(
long)
h->next->next->next->next->next->Data();
2228 ideal
result = (ideal)
Mfrwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2235 if (strcmp(sys_cmd,
"Mprwalk") == 0)
2244 Werror(
"system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
2248 ideal arg1 = (ideal)
h->Data();
2251 int arg4 = (int)(
long)
h->next->next->next->Data();
2252 int arg5 = (int)(
long)
h->next->next->next->next->Data();
2253 int arg6 = (int)(
long)
h->next->next->next->next->next->Data();
2254 int arg7 = (int)(
long)
h->next->next->next->next->next->next->Data();
2255 int arg8 = (int)(
long)
h->next->next->next->next->next->next->next->Data();
2256 int arg9 = (int)(
long)
h->next->next->next->next->next->next->next->next->Data();
2257 ideal
result = (ideal)
Mprwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
2267 if (strcmp(sys_cmd,
"TranMImprovwalk") == 0)
2274 Werror(
"system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2278 ideal arg1 = (ideal)
h->Data();
2291 if (strcmp(sys_cmd,
"MAltwalk2") == 0)
2298 Werror(
"system(\"MAltwalk2\" ...) intvecs not of length %d\n",
2302 ideal arg1 = (ideal)
h->Data();
2314 if (strcmp(sys_cmd,
"TranMImprovwalk") == 0)
2321 Werror(
"system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2325 ideal arg1 = (ideal)
h->Data();
2328 int arg4 = (int) ((
long)(
h->next->next->next->Data()));
2339 if (strcmp(sys_cmd,
"TranMrImprovwalk") == 0)
2344 h->next->next->next ==
NULL ||
h->next->next->next->Typ() !=
INT_CMD ||
2345 h->next->next->next ==
NULL ||
h->next->next->next->next->Typ() !=
INT_CMD ||
2346 h->next->next->next ==
NULL ||
h->next->next->next->next->next->Typ() !=
INT_CMD)
2348 WerrorS(
"system(\"TranMrImprovwalk\", ideal, intvec, intvec) expected");
2354 Werror(
"system(\"TranMrImprovwalk\" ...) intvecs not of length %d\n",
currRing->N);
2357 ideal arg1 = (ideal)
h->Data();
2360 int arg4 = (int)(
long)
h->next->next->next->Data();
2361 int arg5 = (int)(
long)
h->next->next->next->next->Data();
2362 int arg6 = (int)(
long)
h->next->next->next->next->next->Data();
2363 ideal
result = (ideal) TranMrImprovwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2373 #ifndef MAKE_DISTRIBUTION
2384#ifdef HAVE_EXTENDED_SYSTEM
2388# include "hc_newton.h"
2395 char *sys_cmd=(
char *)(
h->Data());
2398 if (strcmp(sys_cmd,
"syz") == 0)
2402 const char *
s=(
const char *)
h->Data();
2403 if (strcmp(
s,
"posInT_EcartFDegpLength")==0)
2405 else if (strcmp(
s,
"posInT_FDegpLength")==0)
2407 else if (strcmp(
s,
"posInT_pLength")==0)
2409 else if (strcmp(
s,
"posInT0")==0)
2411 else if (strcmp(
s,
"posInT1")==0)
2413 else if (strcmp(
s,
"posInT2")==0)
2415 else if (strcmp(
s,
"posInT11")==0)
2417 else if (strcmp(
s,
"posInT110")==0)
2419 else if (strcmp(
s,
"posInT13")==0)
2421 else if (strcmp(
s,
"posInT15")==0)
2423 else if (strcmp(
s,
"posInT17")==0)
2425 else if (strcmp(
s,
"posInT17_c")==0)
2427 else if (strcmp(
s,
"posInT19")==0)
2429 else PrintS(
"valid posInT:0,1,2,11,110,13,15,17,17_c,19,_EcartFDegpLength,_FDegpLength,_pLength,_EcartpLength\n");
2441 if(strcmp(sys_cmd,
"locNF")==0)
2446 poly
f=(poly)
h->Data();
2448 ideal
m=(ideal)
h->Data();
2451 int n=(int)((
long)
h->Data());
2516 if(strcmp(sys_cmd,
"p")==0)
2521 WarnS(
"Sorry: not available for release build!");
2527 if(strcmp(sys_cmd,
"setsyzcomp")==0)
2531 int k = (int)(
long)
h->Data();
2539 if(strcmp(sys_cmd,
"r")==0)
2544 WarnS(
"Sorry: not available for release build!");
2556 if(strcmp(sys_cmd,
"changeRing")==0)
2560 for (
int i = 1;
i <= varN;
i++)
2563 snprintf(
h,10,
"x%d",
i);
2568 res->data = (
void*)0L;
2573 if(strcmp(sys_cmd,
"mtrack")==0)
2584 char *fn=(
char*)
h->Data();
2585 fd = fopen(fn,
"w");
2587 Warn(
"Can not open %s for writing og mtrack. Using stdout",fn);
2591 max = (int)(
long)
h->Data();
2600 WerrorS(
"system(\"mtrack\",..) is not implemented in this version");
2607 if(strcmp(sys_cmd,
"backtrace")==0)
2615#if !defined(OM_NDEBUG)
2617 if (strcmp(sys_cmd,
"omMemoryTest")==0)
2621 PrintS(
"\n[om_Info]: \n");
2623#define OM_PRINT(name) Print(" %-22s : %10ld \n", #name, om_Info . name)
2624 OM_PRINT(MaxBytesSystem);
2625 OM_PRINT(CurrentBytesSystem);
2626 OM_PRINT(MaxBytesSbrk);
2627 OM_PRINT(CurrentBytesSbrk);
2628 OM_PRINT(MaxBytesMmap);
2629 OM_PRINT(CurrentBytesMmap);
2630 OM_PRINT(UsedBytes);
2631 OM_PRINT(AvailBytes);
2632 OM_PRINT(UsedBytesMalloc);
2633 OM_PRINT(AvailBytesMalloc);
2634 OM_PRINT(MaxBytesFromMalloc);
2635 OM_PRINT(CurrentBytesFromMalloc);
2636 OM_PRINT(MaxBytesFromValloc);
2637 OM_PRINT(CurrentBytesFromValloc);
2638 OM_PRINT(UsedBytesFromValloc);
2639 OM_PRINT(AvailBytesFromValloc);
2641 OM_PRINT(UsedPages);
2642 OM_PRINT(AvailPages);
2643 OM_PRINT(MaxRegionsAlloc);
2644 OM_PRINT(CurrentRegionsAlloc);
2649 PrintS(
"\n[om_Opts]: \n");
2650#define OM_PRINT(format, name) Print(" %-22s : %10" format"\n", #name, om_Opts . name)
2651 OM_PRINT(
"d", MinTrack);
2652 OM_PRINT(
"d", MinCheck);
2653 OM_PRINT(
"d", MaxTrack);
2654 OM_PRINT(
"d", MaxCheck);
2655 OM_PRINT(
"d", Keep);
2656 OM_PRINT(
"d", HowToReportErrors);
2657 OM_PRINT(
"d", MarkAsStatic);
2658 OM_PRINT(
"u", PagesPerRegion);
2659 OM_PRINT(
"p", OutOfMemoryFunc);
2660 OM_PRINT(
"p", MemoryLowFunc);
2661 OM_PRINT(
"p", ErrorHook);
2666 Print(
"\n\n[om_ErrorStatus] : '%s' (%s)\n",
2669 Print(
"[om_InternalErrorStatus]: '%s' (%s)\n",
2683 if(strcmp(sys_cmd,
"red")==0)
2698 if(strcmp(sys_cmd,
"fastcomb")==0)
2706 WarnS(
"Wrong types for poly= comb(ideal,poly)");
2711 (ideal)
h->Data(),(poly)
h->next->Data());
2719 if(strcmp(sys_cmd,
"comb")==0)
2727 WarnS(
"Wrong types for poly= comb(ideal,poly)");
2732 (ideal)
h->Data(),(poly)
h->next->Data());
2741 if(strcmp(sys_cmd,
"listall")==0)
2743 void listall(
int showproc);
2745 if ((
h!=
NULL) && (
h->Typ()==
INT_CMD)) showproc=(int)((
long)
h->Data());
2753 if(strcmp(sys_cmd,
"proclist")==0)
2755 void piShowProcList();
2763 if(strcmp(sys_cmd,
"newton")==0)
2767 || (
h->next->next->Typ()!=
INT_CMD))
2769 WerrorS(
"system(\"newton\",<poly>,<int>,<int>) expected");
2772 poly
p=(poly)(
h->Data());
2791 (
int) (
h->next->Data()),
2792 (
int) (
h->next->next->Data())
2805 L->
m[1].
data=(
void *)(
long)r.achse;
2807 L->
m[2].
data=(
void *)(
long)r.deg;
2811 L->
m[3].
data=(
void *)(
long)r.anz_punkte;
2813 int anz = r.anz_punkte;
2816 for (
i=0;
i<anz*
dim;
i++)
2826 (*w)[
i] = r.deg_tab[
i];
2829 while (r.deg_tab[
i-1] != -2);
2840 res->data=(
void *)L;
2863 if (strcmp(sys_cmd,
"minpoly") == 0)
2867 Werror(
"expected exactly one argument: %s",
2868 "a square matrix with number entries");
2878 WerrorS(
"expected exactly one argument: "
2879 "a square matrix with number entries");
2886 res->data = (
void *)theMinPoly;
2887 for (
int i = 0;
i < n;
i++)
delete[] ml[
i];
2889 delete[] polyCoeffs;
2896 if (strcmp(sys_cmd,
"sdb_flags") == 0)
2904 WerrorS(
"system(\"sdb_flags\",`int`) expected");
2913 if (strcmp(sys_cmd,
"sdb_edit") == 0)
2917 WerrorS(
"shell execution is disallowed in restricted mode");
2927 WerrorS(
"system(\"sdb_edit\",`proc`) expected");
2936 if (strcmp(sys_cmd,
"GF") == 0)
2953 if (strcmp(sys_cmd,
"svd") == 0)
2963 if (strcmp(sys_cmd,
"redNF_ring")==0)
2966 poly
f = (poly)
h->Data();
2968 ideal
G = (ideal)
h->Data();
2975 if (strcmp(sys_cmd,
"hilbroune") == 0)
2987 if (strcmp(sys_cmd,
"f5")==0)
2996 ideal
G = (ideal)
h->Data();
3000 opt = (int) (
long)
h->Data();
3008 plus = (int) (
long)
h->Data();
3016 termination = (int) (
long)
h->Data();
3022 res->data=(ideal)
F5main(
G,r,opt,plus,termination);
3028 if (strcmp(sys_cmd,
"NF_ring")==0)
3031 poly
f = (poly)
h->Data();
3033 ideal
G = (ideal)
h->Data();
3039 if (strcmp(sys_cmd,
"spoly")==0)
3041 poly
f =
pCopy((poly)
h->Data());
3043 poly
g =
pCopy((poly)
h->Data());
3050 if (strcmp(sys_cmd,
"testGB")==0)
3052 ideal I = (ideal)
h->Data();
3054 ideal GI = (ideal)
h->Data();
3056 res->data = (
void *)(
long)
testGB(I, GI);
3062 if ( (strcmp(sys_cmd,
"AltVarStart") == 0) || (strcmp(sys_cmd,
"AltVarEnd") == 0) )
3068 WerrorS(
"`system(\"AltVarStart/End\"[,<ring>])` expected");
3076 if(strcmp(sys_cmd,
"AltVarStart") == 0)
3083 WerrorS(
"`system(\"AltVarStart/End\",<ring>) requires a SCA ring");
3089 #ifdef HAVE_RATGRING
3090 if (strcmp(sys_cmd,
"intratNF") == 0)
3105 I=(ideal)
h->CopyD();
3113 is=(int)((
long)(
h->Data()));
3121 for(
k=0;
k < id;
k++)
3125 PrintS(
"starting redRat\n");
3143 if (strcmp(sys_cmd,
"ratNF") == 0)
3162 is=(int)((
long)(
h->Data()));
3177 if (strcmp(sys_cmd,
"ratSpoly") == 0)
3195 is=(int)((
long)(
h->Data()));
3211 if (strcmp(sys_cmd,
"ratVar") == 0)
3228 return (start==0)||(end==0)||(start>end);
3232 if (strcmp(sys_cmd,
"unifastmult")==0)
3234 poly
f = (poly)
h->Data();
3236 poly
g=(poly)
h->Data();
3242 if (strcmp(sys_cmd,
"multifastmult")==0)
3244 poly
f = (poly)
h->Data();
3246 poly
g=(poly)
h->Data();
3252 if (strcmp(sys_cmd,
"mults")==0)
3259 if (strcmp(sys_cmd,
"fastpower")==0)
3262 poly
f = (poly)
h->Data();
3264 int n=(int)((
long)
h->Data());
3270 if (strcmp(sys_cmd,
"normalpower")==0)
3272 poly
f = (poly)
h->Data();
3274 int n=(int)((
long)
h->Data());
3280 if (strcmp(sys_cmd,
"MCpower")==0)
3283 poly
f = (poly)
h->Data();
3285 int n=(int)((
long)
h->Data());
3291 if (strcmp(sys_cmd,
"bit_subst")==0)
3294 poly outer = (poly)
h->Data();
3296 poly inner=(poly)
h->Data();
3303 if (strcmp(sys_cmd,
"gcd") == 0)
3323 int d=(int)(
long)
h->next->Data();
3324 char *
s=(
char *)
h->Data();
3342 if (strcmp(sys_cmd,
"subring") == 0)
3356 if (strcmp(sys_cmd,
"HNF") == 0)
3378 WerrorS(
"expected `system(\"HNF\",<matrix|intmat|bigintmat>)`");
3386 if (strcmp (sys_cmd,
"probIrredTest") == 0)
3391 char *
s=(
char *)
h->next->Data();
3403 if(strcmp(sys_cmd,
"GNUmpLoad")==0)
3407 char* filename = (
char*)
h->Data();
3408 FILE*
f = fopen(filename,
"r");
3411 WerrorS(
"invalid file name (in paths use '/')");
3414 mpz_t
m; mpz_init(
m);
3415 mpz_inp_str(
m,
f, 10);
3419 res->data = (
void*)n;
3424 WerrorS(
"expected valid file name as a string");
3436 if(strcmp(sys_cmd,
"intvecMatchingSegments")==0)
3440 (
h->next->next ==
NULL))
3445 int validEntries = 0;
3446 for (
int k = 0;
k <= ivec->
rows() - jvec->
rows();
k++)
3448 if (memcmp(&(*ivec)[
k], &(*jvec)[0],
3449 sizeof(
int) * jvec->
rows()) == 0)
3451 if (validEntries == 0)
3455 r->
resize(validEntries + 1);
3456 (*r)[validEntries] =
k + 1;
3462 res->data = (
void*)r;
3467 WerrorS(
"expected two non-empty intvecs as arguments");
3478 if(strcmp(sys_cmd,
"intvecOverlap")==0)
3482 (
h->next->next ==
NULL))
3486 int ir = ivec->
rows();
int jr = jvec->
rows();
3487 int r = jr;
if (ir < jr) r = ir;
3488 while ((r >= 1) && (memcmp(&(*ivec)[ir - r], &(*jvec)[0],
3489 sizeof(
int) * r) != 0))
3492 res->data = (
void*)(
long)r;
3497 WerrorS(
"expected two non-empty intvecs as arguments");
3503 if(strcmp(sys_cmd,
"henselfactors")==0)
3508 (
h->next->next->next !=
NULL) &&
3509 (
h->next->next->next->Typ() ==
POLY_CMD) &&
3510 (
h->next->next->next->next !=
NULL) &&
3511 (
h->next->next->next->next->Typ() ==
POLY_CMD) &&
3512 (
h->next->next->next->next->next !=
NULL) &&
3513 (
h->next->next->next->next->next->Typ() ==
INT_CMD) &&
3514 (
h->next->next->next->next->next->next ==
NULL))
3516 int xIndex = (int)(
long)
h->Data();
3517 int yIndex = (int)(
long)
h->next->Data();
3518 poly hh = (poly)
h->next->next->Data();
3519 poly f0 = (poly)
h->next->next->next->Data();
3520 poly g0 = (poly)
h->next->next->next->next->Data();
3521 int d = (int)(
long)
h->next->next->next->next->next->Data();
3529 res->data = (
char *)L;
3534 WerrorS(
"expected argument list (int, int, poly, poly, poly, int)");
3541 if (strcmp(sys_cmd,
"astep") == 0)
3546 I=(ideal)
h->CopyD();
3559 if (strcmp(sys_cmd,
"PrintMat") == 0)
3569 a=(int)((
long)(
h->Data()));
3574 b=(int)((
long)(
h->Data()));
3589 metric=(int)((
long)(
h->Data()));
3600 if(strcmp(sys_cmd,
"NCUseExtensions")==0)
3613 if(strcmp(sys_cmd,
"NCGetType")==0)
3619 res->data=(
void *)(-1L);
3626 if(strcmp(sys_cmd,
"ForceSCA")==0)
3633 b = (int)((
long)(
h->Data()));
3639 e = (int)((
long)(
h->Data()));
3650 if(strcmp(sys_cmd,
"ForceNewNCMultiplication")==0)
3662 if(strcmp(sys_cmd,
"ForceNewOldNCMultiplication")==0)
3674 if(strcmp(sys_cmd,
"test64")==0)
3690 Print(
"SIZEOF_LONG=%d\n",SIZEOF_LONG);
3696 if(strcmp(sys_cmd,
"cache_chinrem")==0)
3707 if(strcmp(sys_cmd,
"LU")==0)
3717 res->data=(
char*)bb;
3722 WerrorS(
"system(\"LU\",<cmatrix>) expected");
3729 if(strcmp(sys_cmd,
"sort")==0)
3739 if(strcmp(sys_cmd,
"uniq")==0)
3749 if(strcmp(sys_cmd,
"GF")==0)
3754 int p=(int)(
long)
h->Data();
3755 int n=(int)(
long)
h->next->Data();
3756 char *
v=(
char*)
h->next->next->CopyD();
3772 if(strcmp(sys_cmd,
"power1")==0)
3775 poly
f=(poly)
h->CopyD();
3777 res->data=(
void *)
g;
3781 if(strcmp(sys_cmd,
"power2")==0)
3784 poly
f=(poly)
h->Data();
3786 for(
int i=0;
i<2000;
i++)
3788 res->data=(
void *)
g;
3791 if(strcmp(sys_cmd,
"power3")==0)
3794 poly
f=(poly)
h->Data();
3805 poly p1536=
pMult(p1024,p512);
3806 poly p1792=
pMult(p1536,p256);
3807 poly p1920=
pMult(p1792,p128);
3808 poly p1984=
pMult(p1920,p64);
3809 poly p2000=
pMult(p1984,p16);
3810 res->data=(
void *)p2000;
3831 if(strcmp(sys_cmd,
"ccluster")==0)
3841 int pol_with_complex_coeffs=0;
3843 pol_with_complex_coeffs=1;
3849 fmpq_poly_t fre, fim;
3851 if (pol_with_complex_coeffs==1)
3856 fmpq_t center_re,center_im,boxsize,eps;
3862 int n=fmpq_poly_length(fre);
3863 fmpq_t* re_part=(fmpq_t*)
omAlloc(n*
sizeof(fmpq_t));
3864 fmpq_t* im_part=(fmpq_t*)
omAlloc(n*
sizeof(fmpq_t));
3866 for(
int i=0;
i<n;
i++)
3867 { fmpq_init(re_part[
i]); fmpq_init(im_part[
i]); }
3872 long nb_threads = (long)
feOptValue(FE_OPT_CPUS);
3873 strategy = strategy+(nb_threads<<6);
3876 if (pol_with_complex_coeffs==0)
3877 nn=ccluster_interface_poly_real(re_part,im_part,
mult,fre,center_re,center_im,boxsize,eps,strategy,verbosity);
3879 nn=ccluster_interface_poly_real_imag(re_part,im_part,
mult,fre,fim,center_re,center_im,boxsize,eps,strategy,verbosity);
3883 for(
int i=0;
i<nn;
i++)
3897 for(
int i=n-1;
i>=0;
i--) { fmpq_clear(re_part[
i]); fmpq_clear(im_part[
i]); }
3901 fmpq_clear(center_re); fmpq_clear(center_im); fmpq_clear(boxsize); fmpq_clear(eps);
3902 fmpq_poly_clear(fre);
3903 if (pol_with_complex_coeffs==1) fmpq_poly_clear(fim);
3915 if(strcmp(sys_cmd,
"evaluate")==0)
3917 extern number
maEvalAt(
const poly
p,
const number* pt,
const ring r);
3920 WerrorS(
"expected system(\"evaluate\",<poly>,..)");
3923 poly
p=(poly)
h->Data();
3930 WerrorS(
"system(\"evaluate\",<poly>,<number>..) - expect number");
3933 pt[
i]=(number)
h->Data();
3941 if(strcmp(sys_cmd,
"DivRem")==0)
3946 poly
p=(poly)
h->CopyD();
3947 poly q=(poly)
h->next->CopyD();
3956 WerrorS(
"expected system(\"DivRem\",<poly>,<poly>)");
3962 if(strcmp(sys_cmd,
"DivRemIdU")==0)
3969 ideal
p=(ideal)
h->CopyD();
3970 ideal q=(ideal)
h->next->CopyD();
3973 ideal rest=
idDivRem(
p,q,factors,&unit,0);
3988 WerrorS(
"expected system(\"DivRemId\",<ideal>,<ideal>)");
3993 if(strcmp(sys_cmd,
"DivRemId")==0)
4000 ideal
p=(ideal)
h->CopyD();
4001 ideal q=(ideal)
h->next->CopyD();
4015 WerrorS(
"expected system(\"DivRemId\",<ideal>,<ideal>)");
4021 if(strcmp(sys_cmd,
"CoeffTerm")==0)
4034 poly
p=(poly)
h->Data();
4035 poly q=(poly)
h->next->Data();
4043 ideal
p=(ideal)
h->Data();
4044 poly q=(poly)
h->next->Data();
4051 poly
p=(poly)
h->Data();
4052 poly q=(poly)
h->next->Data();
4059 ideal
p=(ideal)
h->Data();
4060 poly q=(poly)
h->next->Data();
4067 poly
p=(poly)
h->Data();
4068 ideal q=(ideal)
h->next->Data();
4075 poly
p=(poly)
h->Data();
4076 ideal q=(ideal)
h->next->Data();
4083 WerrorS(
"expected system(\"CoeffTerm\",<poly>/<vector>,<poly>/<vector>)" "\n or <ideal>/<module>,<poly>/<vector>");
4089 if(strcmp(sys_cmd,
"sat1")==0)
4091 ideal I= (ideal)
h->Data();
4092 ideal J=(ideal)
h->next->Data();
4099 if(strcmp(sys_cmd,
"minres_with_map")==0)
4107 res->next->data=(
void*)trans;
4114 if(strcmp(sys_cmd,
"sat_with_exp")==0)
4116 ideal I= (ideal)
h->Data();
4117 ideal J=(ideal)
h->next->Data();
static int si_max(const int a, const int b)
#define BIMATELEM(M, I, J)
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
void printBlackboxTypes()
list all defined type (for debugging)
EXTERN_VAR int singular_homog_flag
static const int SW_USE_CHINREM_GCD
set to 1 to use modular gcd over Z
static const int SW_USE_FL_GCD_P
set to 1 to use Flints gcd over F_p
static const int SW_USE_EZGCD_P
set to 1 to use EZGCD over F_q
static const int SW_USE_EZGCD
set to 1 to use EZGCD over Z
static const int SW_USE_FL_GCD_0
set to 1 to use Flints gcd over Q/Z
static CanonicalForm bound(const CFMatrix &M)
void factoryseed(int s)
random seed initializer
CanonicalForm convSingPFactoryP(poly p, const ring r)
matrix singntl_HNF(matrix m, const ring s)
matrix singntl_rref(matrix m, const ring R)
matrix singntl_LLL(matrix m, const ring s)
ideal singclap_absFactorize(poly f, ideal &mipos, intvec **exps, int &numFactors, const ring r)
char * singclap_neworder(ideal I, const ring r)
gmp_complex numbers based on
void resize(int new_length)
Class used for (list of) interpreter objects.
INLINE_THIS void Init(int l=0)
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 ....
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
static FORCE_INLINE number n_convFactoryNSingN(const CanonicalForm n, const coeffs r)
void n_Print(number &a, const coeffs r)
print a number (BEWARE of string buffers!) mostly for debugging
static FORCE_INLINE CanonicalForm n_convSingNFactoryN(number n, BOOLEAN setChar, const coeffs r)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE number n_InitMPZ(mpz_t n, const coeffs r)
conversion of a GMP integer to number
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Creation data needed for finite fields.
void countedref_reference_load()
Initialize blackbox types 'reference' and 'shared', or both.
void countedref_shared_load()
poly uni_subst_bits(poly outer_uni, poly inner_multi, ring r)
matrix evRowElim(matrix M, int i, int j, int k)
matrix evHessenberg(matrix M)
matrix evSwap(matrix M, int i, int j)
lists evEigenvals(matrix M)
ideal F5main(ideal id, ring r, int opt, int plus, int termination)
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
CFList int bool & irred
[in,out] Is A irreducible?
int probIrredTest(const CanonicalForm &F, double error)
given some error probIrredTest detects irreducibility or reducibility of F with confidence level 1-er...
‘factory.h’ is the user interface to Factory.
poly unifastmult(poly f, poly g, ring r)
poly pFastPowerMC(poly f, int n, ring r)
static int max(int a, int b)
poly pFastPower(poly f, int n, ring r)
poly multifastmult(poly f, poly g, ring r)
void WerrorS(const char *s)
feOptIndex feGetOptIndex(const char *name)
const char * feSetOptValue(feOptIndex opt, char *optarg)
static void * feOptValue(feOptIndex opt)
EXTERN_VAR struct fe_option feOptSpec[]
static char * feResource(feResourceConfig config, int warn)
void feStringAppendBrowsers(int warn)
STATIC_VAR int nfMinPoly[16]
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
const char * Tok2Cmdname(int tok)
lists gmsNF(ideal p, ideal g, matrix B, int D, int K)
void HilbertSeries_OrbitData(ideal S, int lV, bool IG_CASE, bool mgrad, bool odp, int trunDegHs)
ideal RightColonOperation(ideal S, poly w, int lV)
ideal id_Sat_principal(ideal I, ideal J, const ring origR)
ideal idSaturate(ideal I, ideal J, int &k, BOOLEAN isIdeal)
ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing)
STATIC_VAR coordinates * points
static BOOLEAN length(leftv result, leftv arg)
#define IMATELEM(M, I, J)
BOOLEAN jjSORTLIST(leftv, leftv arg)
BOOLEAN jjUNIQLIST(leftv, leftv arg)
EXTERN_VAR omBin sleftv_bin
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
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 (...
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
BOOLEAN spectrumfProc(leftv result, leftv first)
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
BOOLEAN spectrumProc(leftv result, leftv first)
ring rSubring(ring org_ring, sleftv *rv)
BOOLEAN semicProc(leftv res, leftv u, leftv v)
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
ideal idDivRem(ideal A, const ideal quot, ideal &factor, ideal *unit, int lazyReduce)
poly fglmLinearCombination(ideal source, poly monset)
poly fglmNewLinearCombination(ideal source, poly monset)
poly kNFBound(ideal F, ideal Q, poly p, int bound, int syzComp, int lazyReduce)
VAR int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
VAR int(* test_PosInT)(const TSet T, const int tl, LObject &h)
int posInT17(const TSet set, const int length, LObject &p)
int posInT11(const TSet set, const int length, LObject &p)
int posInT1(const TSet set, const int length, LObject &p)
int posInT0(const TSet, const int length, LObject &)
int posInT2(const TSet set, const int length, LObject &p)
int posInT_pLength(const TSet set, const int length, LObject &p)
int posInT13(const TSet set, const int length, LObject &p)
int posInT17_c(const TSet set, const int length, LObject &p)
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
int posInT15(const TSet set, const int length, LObject &p)
int posInT110(const TSet set, const int length, LObject &p)
int posInT19(const TSet set, const int length, LObject &p)
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
BOOLEAN kVerify2(ideal F, ideal Q)
BOOLEAN kVerify1(ideal F, ideal Q)
static bool rIsSCA(const ring r)
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
static nc_type & ncRingType(nc_struct *p)
int setNCExtensions(int iMask)
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)
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...
matrix mp_Transp(matrix a, const ring R)
ideal sm_UnFlatten(ideal a, int col, const ring R)
matrix mp_InitI(int r, int c, int v, const ring R)
make it a v * unit matrix
matrix mpNew(int r, int c)
create a r x c zero-matrix
ideal sm_Flatten(ideal a, const ring R)
#define MATELEM(mat, i, j)
1-based access to matrix
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
unsigned long * computeMinimalPolynomial(unsigned long **matrix, unsigned n, unsigned long p)
This file provides miscellaneous functionality.
EXTERN_VAR size_t gmp_output_digits
bool complexNearZero(gmp_complex *c, int digits)
The main handler for Singular numbers which are suitable for Singular polynomials.
BOOLEAN ncInitSpecialPairMultiplication(ring r)
ideal Approx_Step(ideal L)
Ann: ???
ideal twostd(ideal I)
Compute two-sided GB:
void newstructShow(newstruct_desc d)
BOOLEAN newstruct_set_proc(const char *bbname, const char *func, int args, procinfov pr)
#define omFreeSize(addr, size)
const char * omError2String(omError_t error)
const char * omError2Serror(omError_t error)
omError_t om_InternalErrorStatus
char * omFindExec(const char *name, char *exec)
#define omPrintCurrentBackTrace(fd)
poly p_CoeffTermMo(poly v, ideal m, int n, const ring r)
find coeffs of a vector of a matrix(module) of given monomials, n>=max_comp(v)
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)
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
ideal id_CoeffTermV(ideal M, poly m, const ring r)
find coeffs of (polynomial) m in all vectors from I
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...
poly p_CoeffTermV(poly v, poly m, const ring r)
find vector of coeffs of (polynomial) m in vector v
void p_Content(poly ph, const ring r)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
poly p_Cleardenom(poly p, const ring r)
static int pLength(poly a)
static poly p_Add_q(poly p, poly q, const ring r)
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
static void p_Setm(poly p, const ring r)
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
poly pcvP2CV(poly p, int d0, int d1)
int pcvBasis(lists b, int i, poly m, int d, int n)
int pcvDim(int d0, int d1)
lists pcvPMulL(poly p, lists l1)
poly pcvCV2P(poly cv, int d0, int d1)
lists pcvLAddL(lists l1, lists l2)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
poly p_DivRem(poly p, poly q, poly &rest, const ring r)
Compatibility layer for legacy polynomial operations (over currRing)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
#define pLmDeleteAndNext(p)
like pLmDelete, returns pNext(p)
#define pGetExp(p, i)
Exponent.
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
#define pCopy(p)
return a copy of the poly
poly nc_rat_CreateSpoly(poly pp1, poly pp2, int ishift, const ring r)
int redRat(poly *h, poly *reducer, int *red_length, int rl, int ishift, ring r)
poly nc_rat_ReduceSpolyNew(const poly p1, poly p2, int ishift, const ring r)
void StringSetS(const char *st)
const char feNotImplemented[]
void PrintS(const char *s)
void Werror(const char *fmt,...)
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...
void p_DebugPrint(poly p, const ring r)
void rDebugPrint(const ring r)
void rSetSyzComp(int k, const ring r)
static BOOLEAN rField_is_R(const ring r)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static BOOLEAN rField_is_long_C(const ring r)
static int rBlocks(const ring r)
static BOOLEAN rField_is_Q(const ring r)
static BOOLEAN rIsNCRing(const ring r)
static BOOLEAN rField_is_long_R(const ring r)
#define rField_is_Ring(R)
poly ringNF(poly f, ideal G, ring r)
poly plain_spoly(poly f, poly g)
poly ringRedNF(poly f, ideal G, ring r)
int testGB(ideal I, ideal GI)
static short scaLastAltVar(ring r)
static short scaFirstAltVar(ring r)
void sdb_edit(procinfo *pi)
int simpleipc_cmd(char *cmd, int id, int v)
ideal id_Vec2Ideal(poly vec, const ring R)
matrix id_Module2Matrix(ideal mod, const ring R)
int ssiReservePort(int clients)
BOOLEAN assumeStdFlag(leftv h)
void syMinimize_with_map(syStrategy res, ideal &trans)
syStrategy syCopy(syStrategy syzstr)
int M3ivSame(intvec *temp, intvec *u, intvec *v)
intvec * MivWeightOrderdp(intvec *ivstart)
ideal TranMImprovwalk(ideal G, intvec *curr_weight, intvec *target_tmp, int nP)
intvec * MivMatrixOrderdp(int nV)
ideal Mfwalk(ideal G, intvec *ivstart, intvec *ivtarget, int reduction, int printout)
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
intvec * MivWeightOrderlp(intvec *ivstart)
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)
intvec * MivMatrixOrder(intvec *iv)
ideal MAltwalk2(ideal Go, intvec *curr_weight, intvec *target_weight)
ideal MAltwalk1(ideal Go, int op_deg, int tp_deg, 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)
ideal Mfrwalk(ideal G, intvec *ivstart, intvec *ivtarget, int weight_rad, int reduction, int printout)
ideal Mwalk(ideal Go, intvec *orig_M, intvec *target_M, ring baseRing, int reduction, int printout)
ideal Mpwalk(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight, int nP, int reduction, int printout)
int MivSame(intvec *u, intvec *v)
ideal MwalkInitialForm(ideal G, intvec *ivw)
intvec * MivMatrixOrderlp(int nV)
intvec * Mfpertvector(ideal G, intvec *ivtarget)
intvec * MPertVectorslp(ideal G, intvec *ivtarget, int pdeg)
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
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)
#define omMarkAsStaticAddr(A)
#define omPrintUsedTrackAddrs(F, max)