20#include "ccluster/ccluster.h"
25#ifdef TIME_WITH_SYS_TIME
27# ifdef HAVE_SYS_TIME_H
31# ifdef HAVE_SYS_TIME_H
37#ifdef HAVE_SYS_TIMES_H
137#ifndef MAKE_DISTRIBUTION
138#define HAVE_EXTENDED_SYSTEM 1
163#ifndef MAKE_DISTRIBUTION
175 int n = singularMatrix->
rows();
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++)
185 poly
p=
MATELEM(singularMatrix, r + 1, c + 1);
195 longMatrix[r][c] = (
unsigned long)entryAsInt;
210 if ((
int)polyCoeffs[
i] != 0)
231 const char *sys_cmd=(
char *)(args->
Data());
236 if (strcmp(sys_cmd,
"nblocks") == 0)
258 r = (ring)
h->Data();
265 if(strcmp(sys_cmd,
"version")==0)
273 if(strcmp(sys_cmd,
"alarm")==0)
280 struct itimerval t,o;
281 memset(&t,0,
sizeof(t));
282 t.it_value.tv_sec =(unsigned)((
unsigned long)
h->Data());
283 setitimer(ITIMER_VIRTUAL,&t,&o);
291 if(strcmp(sys_cmd,
"content")==0)
296 poly
p=(poly)
h->CopyD();
310 if(strcmp(sys_cmd,
"cpu")==0)
314 #ifdef _SC_NPROCESSORS_ONLN
315 cpu=sysconf(_SC_NPROCESSORS_ONLN);
316 #elif defined(_SC_NPROCESSORS_CONF)
317 cpu=sysconf(_SC_NPROCESSORS_CONF);
319 res->data=(
void *)cpu;
328 if(strcmp(sys_cmd,
"executable")==0)
343 if(strcmp(sys_cmd,
"flatten")==0)
356 if(strcmp(sys_cmd,
"unflatten")==0)
369 if(strcmp(sys_cmd,
"neworder")==0)
383 if(strcmp(sys_cmd,
"nc_hilb") == 0)
391 i = (ideal)
h->Data();
394 WerrorS(
"nc_Hilb:ideal expected");
399 lV = (int)(
long)
h->Data();
402 WerrorS(
"nc_Hilb:int expected");
408 if((
int)(
long)
h->Data() == 1)
410 else if((
int)(
long)
h->Data() == 2)
415 trunDegHs = (int)(
long)
h->Data();
420 WerrorS(
"nc_Hilb:int 1,2, total degree for the truncation, and a string for printing the details are expected");
429 if(strcmp(sys_cmd,
"verifyGB")==0)
433 WerrorS(
"system(\"verifyGB\",<ideal>,..) expects a commutative ring");
439 Werror(
"expected system(\"verifyGB\",<ideal/module>), found <%s>",
Tok2Cmdname(
h->Typ()));
442 ideal F=(ideal)
h->Data();
449 if(strcmp(sys_cmd,
"rcolon") == 0)
454 ideal
i = (ideal)
h->Data();
456 poly
w=(poly)
h->Data();
458 int lV = (int)(
long)
h->Data();
469 if(strcmp(sys_cmd,
"sh")==0)
473 WerrorS(
"shell execution is disallowed in restricted mode");
477 if (
h==
NULL)
res->data = (
void *)(
long) system(
"sh");
479 res->data = (
void*)(
long) system((
char*)(
h->Data()));
482 if (errno==ECHILD)
res->data=
NULL;
487 if(strcmp(sys_cmd,
"reduce_bound")==0)
497 p = (poly)
h->CopyD();
501 pid = (ideal)
h->CopyD();
506 ideal q = (ideal)
h->next->CopyD();
507 int bound = (int)(
long)
h->next->next->Data();
516 if(strcmp(sys_cmd,
"uname")==0)
524 if(strcmp(sys_cmd,
"with")==0)
534 #define TEST_FOR(A) if(strcmp(s,A)==0) res->data=(void *)1; else
535 char *
s=(
char *)
h->Data();
548 #ifdef TEST_MAC_ORDER
553 #ifdef HAVE_DYNAMIC_LOADING
576 if (strcmp(sys_cmd,
"browsers")==0)
586 if (strcmp(sys_cmd,
"pid")==0)
589 res->data=(
void *)(
long) getpid();
594 if (strcmp(sys_cmd,
"getenv")==0)
599 const char *r=
getenv((
char *)
h->Data());
612 if (strcmp(sys_cmd,
"setenv")==0)
619 setenv((
char *)
h->Data(), (
char *)
h->next->Data(), 1);
629 WerrorS(
"setenv not supported on this platform");
635 if (strcmp(sys_cmd,
"Singular") == 0)
644 if (strcmp(sys_cmd,
"SingularLib") == 0)
653 if (strcmp(sys_cmd,
"SingularBin") == 0)
657 if (r ==
NULL) r=
"/usr/local";
660 #define SINGULAR_PROCS_DIR "/libexec/singular/MOD"
663 if ((strstr(r,
".libs/..")==
NULL)
664 &&(strstr(r,
"Singular/..")==
NULL))
668 if (access(
s,X_OK)==0)
675 strcpy(
s,LIBEXEC_DIR);
676 if (access(
s,X_OK)==0)
699 res->data = (
void*)
s;
704 if (strstr(sys_cmd,
"--") == sys_cmd)
706 if (strcmp(sys_cmd,
"--") == 0)
714 Werror(
"Unknown option %s", sys_cmd);
715 WerrorS(
"Use 'system(\"--\");' for listing of available options");
730 const char *r=(
const char*)
feOptSpec[opt].value;
741 const char* errormsg=
NULL;
746 Werror(
"Need string argument to set value of option %s", sys_cmd);
750 if (errormsg !=
NULL)
751 Werror(
"Option '--%s=%d' %s", sys_cmd, (
int) ((
long)
h->Data()), errormsg);
756 if (errormsg !=
NULL)
757 Werror(
"Option '--%s=%s' %s", sys_cmd, (
char*)
h->Data(), errormsg);
761 WerrorS(
"Need string or int argument to set option value");
769 if (strcmp(sys_cmd,
"HC")==0)
777 if(strcmp(sys_cmd,
"random")==0)
800 if (strcmp(sys_cmd,
"denom_list")==0)
809 if(strcmp(sys_cmd,
"complexNearZero")==0)
816 WerrorS(
"unsupported ground field!");
823 (
int)((
long)(
h->next->Data())));
834 if(strcmp(sys_cmd,
"getPrecDigits")==0)
839 WerrorS(
"unsupported ground field!");
850 if(strcmp(sys_cmd,
"lduDecomp")==0)
857 poly
l; poly u; poly prodLU;
858 lduDecomp(aMat, pMat, lMat, dMat, uMat,
l, u, prodLU);
869 res->data = (
char *)L;
879 if(strcmp(sys_cmd,
"lduSolve")==0)
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();
920 Werror(
"first matrix (%d x %d) is not quadratic",
926 Werror(
"second matrix (%d x %d) is not quadratic",
932 Werror(
"third matrix (%d x %d) is not quadratic",
938 Werror(
"third matrix (%d x %d) and fourth matrix (%d x %d) %s",
945 Werror(
"fourth matrix (%d x %d) and vector (%d x 1) do not fit",
950 bVec, xVec, homogSolSpace);
973 if (strcmp(sys_cmd,
"shared") == 0)
975 #ifndef SI_COUNTEDREF_AUTOLOAD
982 else if (strcmp(sys_cmd,
"reference") == 0)
984 #ifndef SI_COUNTEDREF_AUTOLOAD
994 if (strcmp(sys_cmd,
"semaphore")==0)
1000 v=(int)(
long)
h->next->next->Data();
1007 WerrorS(
"Usage: system(\"semaphore\",<cmd>,int)");
1014 if (strcmp(sys_cmd,
"reserve")==0)
1021 res->data=(
void*)(
long)
p;
1028 if (strcmp(sys_cmd,
"reservedLink")==0)
1037 if (strcmp(sys_cmd,
"install")==0)
1043 (
int)(
long)
h->next->next->next->Data(),
1050 if (strcmp(sys_cmd,
"newstruct")==0)
1056 char *n=(
char*)
h->Data();
1063 newstruct_desc desc=(newstruct_desc)bb->data;
1067 else Werror(
"'%s' is not a newstruct",n);
1069 else Werror(
"'%s' is not a blackbox object",n);
1075 if (strcmp(sys_cmd,
"blackbox")==0)
1082 #if defined(HAVE_FLINT) || defined(HAVE_NTL)
1083 if (strcmp(sys_cmd,
"absFact") == 0)
1100 l->m[0].data=(
void *)
f;
1102 l->m[1].data=(
void *)
v;
1104 l->m[2].data=(
void*) mipos;
1106 l->m[3].data=(
void*) (
long) n;
1107 res->data=(
void *)
l;
1116 if (strcmp(sys_cmd,
"LLL") == 0)
1139 #if __FLINT_RELEASE >= 20500
1140 if (strcmp(sys_cmd,
"LLL_Flint") == 0)
1161 WerrorS(
"matrix,int or bigint,int expected");
1166 if(((
int)((
long)(
h->next->Data())) != 0) && (
int)((
long)(
h->next->Data()) != 1))
1168 WerrorS(
"int is different from 0, 1");
1172 if((
long)(
h->next->Data()) == 0)
1187 if((
long)(
h->next->Data()) == 1)
1193 for(
int i = 1;
i<=
m->rows();
i++)
1211 for(
int i = 1;
i<=
m->rows();
i++)
1233 #if defined(HAVE_FLINT) || defined(HAVE_NTL)
1234 if(strcmp(sys_cmd,
"rref")==0)
1241 #if defined(HAVE_FLINT)
1243 #elif defined(HAVE_NTL)
1251 ideal
M=(ideal)
h->Data();
1252 #if defined(HAVE_FLINT)
1254 #elif defined(HAVE_NTL)
1262 WerrorS(
"expected system(\"rref\",<matrix>/<smatrix>)");
1270 if(strcmp(sys_cmd,
"pcvLAddL")==0)
1275 if(strcmp(sys_cmd,
"pcvPMulL")==0)
1280 if(strcmp(sys_cmd,
"pcvMinDeg")==0)
1285 if(strcmp(sys_cmd,
"pcvP2CV")==0)
1290 if(strcmp(sys_cmd,
"pcvCV2P")==0)
1295 if(strcmp(sys_cmd,
"pcvDim")==0)
1300 if(strcmp(sys_cmd,
"pcvBasis")==0)
1307 #ifdef HAVE_EIGENVAL
1308 if(strcmp(sys_cmd,
"hessenberg")==0)
1315 #ifdef HAVE_EIGENVAL
1316 if(strcmp(sys_cmd,
"eigenvals")==0)
1323 #ifdef HAVE_EIGENVAL
1324 if(strcmp(sys_cmd,
"rowelim")==0)
1331 #ifdef HAVE_EIGENVAL
1332 if(strcmp(sys_cmd,
"rowcolswap")==0)
1340 if(strcmp(sys_cmd,
"gmsnf")==0)
1347 if(strcmp(sys_cmd,
"contributors") == 0)
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");
1356 #ifdef HAVE_SPECTRUM
1357 if(strcmp(sys_cmd,
"spectrum") == 0)
1371 if(((
long)
h->next->Data())==1L)
1377 if(strcmp(sys_cmd,
"semic") == 0)
1383 if (
h->next->next==
NULL)
1385 else if (
h->next->next->Typ()==
INT_CMD)
1392 if(strcmp(sys_cmd,
"spadd") == 0)
1403 if(strcmp(sys_cmd,
"spmul") == 0)
1415 #define HAVE_SHEAFCOH_TRICKS 1
1417 #ifdef HAVE_SHEAFCOH_TRICKS
1418 if(strcmp(sys_cmd,
"tensorModuleMult")==0)
1424 int m = (int)( (
long)
h->Data() );
1425 ideal
M = (ideal)
h->next->Data();
1436 if (strcmp(sys_cmd,
"twostd") == 0)
1441 I=(ideal)
h->CopyD();
1455 if (strcmp(sys_cmd,
"bracket") == 0)
1460 poly
p=(poly)
h->CopyD();
1462 poly q=(poly)
h->Data();
1473 if (strcmp(sys_cmd,
"env")==0)
1477 ring r = (ring)
h->Data();
1484 WerrorS(
"`system(\"env\",<ring>)` expected");
1492 if (strcmp(sys_cmd,
"opp")==0)
1496 ring r=(ring)
h->Data();
1503 WerrorS(
"`system(\"opp\",<ring>)` expected");
1511 if (strcmp(sys_cmd,
"oppose")==0)
1514 && (
h->next!=
NULL))
1516 ring Rop = (ring)
h->Data();
1529 WerrorS(
"`system(\"oppose\",<ring>,<poly>)` expected");
1536 if(strcmp(sys_cmd,
"sat")==0)
1538 ideal I= (ideal)
h->Data();
1539 ideal J=(ideal)
h->next->Data();
1552 if (strcmp(sys_cmd,
"walkNextWeight") == 0)
1559 Werror(
"system(\"walkNextWeight\" ...) intvecs not of length %d\n",
1563 res->data = (
void*) walkNextWeight(((
intvec*)
h->Data()),
1565 (ideal)
h->next->next->Data());
1566 if (
res->data ==
NULL ||
res->data == (
void*) 1L)
1582 if (strcmp(sys_cmd,
"walkInitials") == 0)
1586 WerrorS(
"system(\"walkInitials\", ideal) expected");
1589 res->data = (
void*) walkInitials((ideal)
h->Data());
1599 if (strcmp(sys_cmd,
"walkAddIntVec") == 0)
1605 res->data = (
intvec*) walkAddIntVec(arg1, arg2);
1614 #ifdef MwaklNextWeight
1615 if (strcmp(sys_cmd,
"MwalkNextWeight") == 0)
1622 Werror(
"system(\"MwalkNextWeight\" ...) intvecs not of length %d\n",
1628 ideal arg3 = (ideal)
h->next->next->Data();
1639 if(strcmp(sys_cmd,
"Mivdp") == 0)
1643 WerrorS(
"system(\"Mivdp\", int) expected");
1646 if ((
int) ((
long)(
h->Data())) !=
currRing->N)
1648 Werror(
"system(\"Mivdp\" ...) intvecs not of length %d\n",
1652 int arg1 = (int) ((
long)(
h->Data()));
1662 if(strcmp(sys_cmd,
"Mivlp") == 0)
1666 WerrorS(
"system(\"Mivlp\", int) expected");
1669 if ((
int) ((
long)(
h->Data())) !=
currRing->N)
1671 Werror(
"system(\"Mivlp\" ...) intvecs not of length %d\n",
1675 int arg1 = (int) ((
long)(
h->Data()));
1686 if(strcmp(sys_cmd,
"MpDiv") == 0)
1690 poly arg1 = (poly)
h->Data();
1691 poly arg2 = (poly)
h->next->Data();
1692 poly
result = MpDiv(arg1, arg2);
1703 if(strcmp(sys_cmd,
"MpMult") == 0)
1707 poly arg1 = (poly)
h->Data();
1708 poly arg2 = (poly)
h->next->Data();
1709 poly
result = MpMult(arg1, arg2);
1719 if (strcmp(sys_cmd,
"MivSame") == 0)
1740 res->data = (
void*)(
long)
MivSame(arg1, arg2);
1747 if (strcmp(sys_cmd,
"M3ivSame") == 0)
1770 res->data = (
void*)(
long)
M3ivSame(arg1, arg2, arg3);
1777 if(strcmp(sys_cmd,
"MwalkInitialForm") == 0)
1783 Werror(
"system \"MwalkInitialForm\"...) intvec not of length %d\n",
1787 ideal
id = (ideal)
h->Data();
1799 if(strcmp(sys_cmd,
"MivMatrixOrder") == 0)
1803 WerrorS(
"system(\"MivMatrixOrder\",intvec) expected");
1816 if(strcmp(sys_cmd,
"MivMatrixOrderdp") == 0)
1820 WerrorS(
"system(\"MivMatrixOrderdp\",intvec) expected");
1823 int arg1 = (int) ((
long)(
h->Data()));
1833 if(strcmp(sys_cmd,
"MPertVectors") == 0)
1837 ideal arg1 = (ideal)
h->Data();
1839 int arg3 = (int) ((
long)(
h->next->next->Data()));
1849 if(strcmp(sys_cmd,
"MPertVectorslp") == 0)
1853 ideal arg1 = (ideal)
h->Data();
1855 int arg3 = (int) ((
long)(
h->next->next->Data()));
1865 if(strcmp(sys_cmd,
"Mfpertvector") == 0)
1869 ideal arg1 = (ideal)
h->Data();
1880 if(strcmp(sys_cmd,
"MivUnit") == 0)
1884 int arg1 = (int) ((
long)(
h->Data()));
1894 if(strcmp(sys_cmd,
"MivWeightOrderlp") == 0)
1908 if(strcmp(sys_cmd,
"MivWeightOrderdp") == 0)
1912 WerrorS(
"system(\"MivWeightOrderdp\",intvec) expected");
1926 if(strcmp(sys_cmd,
"MivMatrixOrderlp") == 0)
1930 WerrorS(
"system(\"MivMatrixOrderlp\",int) expected");
1933 int arg1 = (int) ((
long)(
h->Data()));
1943 if (strcmp(sys_cmd,
"MkInterRedNextWeight") == 0)
1950 Werror(
"system(\"MkInterRedNextWeight\" ...) intvecs not of length %d\n",
1956 ideal arg3 = (ideal)
h->next->next->Data();
1966 #ifdef MPertNextWeight
1967 if (strcmp(sys_cmd,
"MPertNextWeight") == 0)
1973 Werror(
"system(\"MPertNextWeight\" ...) intvecs not of length %d\n",
1978 ideal arg2 = (ideal)
h->next->Data();
1979 int arg3 = (int)
h->next->next->Data();
1990 #ifdef Mivperttarget
1991 if (strcmp(sys_cmd,
"Mivperttarget") == 0)
1995 ideal arg1 = (ideal)
h->Data();
1996 int arg2 = (int)
h->next->Data();
2007 if (strcmp(sys_cmd,
"Mwalk") == 0)
2014 Werror(
"system(\"Mwalk\" ...) intvecs not of length %d\n",
2018 ideal arg1 = (ideal)
h->CopyD();
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);
2034 if (strcmp(sys_cmd,
"Mwalk") == 0)
2043 Werror(
"system(\"Mwalk\" ...) intvecs not of length %d or %d\n",
2047 ideal arg1 = (ideal)
h->Data();
2050 ring arg4 = (ring)
h->next->next->next->Data();
2051 ideal
result = (ideal)
Mwalk(arg1, arg2, arg3,arg4);
2058 if (strcmp(sys_cmd,
"Mpwalk") == 0)
2062 if(((
intvec*)
h->next->next->next->Data())->length() !=
currRing->N &&
2065 Werror(
"system(\"Mpwalk\" ...) intvecs not of length %d\n",
currRing->N);
2068 ideal arg1 = (ideal)
h->Data();
2069 int arg2 = (int) (
long)
h->next->Data();
2070 int arg3 = (int) (
long)
h->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);
2086 if (strcmp(sys_cmd,
"Mrwalk") == 0)
2095 Werror(
"system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
2099 ideal arg1 = (ideal)
h->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);
2115 if (strcmp(sys_cmd,
"MAltwalk1") == 0)
2119 if (((
intvec*)
h->next->next->next->Data())->length() !=
currRing->N &&
2122 Werror(
"system(\"MAltwalk1\" ...) intvecs not of length %d\n",
2126 ideal arg1 = (ideal)
h->Data();
2127 int arg2 = (int) ((
long)(
h->next->Data()));
2128 int arg3 = (int) ((
long)(
h->next->next->Data()));
2141 if (strcmp(sys_cmd,
"Mfwalk_alt") == 0)
2148 Werror(
"system(\"Mfwalk\" ...) intvecs not of length %d\n",
2152 ideal arg1 = (ideal)
h->Data();
2155 int arg4 = (int)
h->next->next->next->Data();
2156 ideal
result = (ideal) Mfwalk_alt(arg1, arg2, arg3, arg4);
2166 if (strcmp(sys_cmd,
"Mfwalk") == 0)
2173 Werror(
"system(\"Mfwalk\" ...) intvecs not of length %d\n",
2177 ideal arg1 = (ideal)
h->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);
2191 if (strcmp(sys_cmd,
"Mfrwalk") == 0)
2208 Werror(
"system(\"Mfrwalk\" ...) intvecs not of length %d or %d\n",
2213 ideal arg1 = (ideal)
h->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);
2226 if (strcmp(sys_cmd,
"Mprwalk") == 0)
2235 Werror(
"system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
2239 ideal arg1 = (ideal)
h->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);
2258 if (strcmp(sys_cmd,
"TranMImprovwalk") == 0)
2265 Werror(
"system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2269 ideal arg1 = (ideal)
h->Data();
2282 if (strcmp(sys_cmd,
"MAltwalk2") == 0)
2289 Werror(
"system(\"MAltwalk2\" ...) intvecs not of length %d\n",
2293 ideal arg1 = (ideal)
h->Data();
2305 if (strcmp(sys_cmd,
"TranMImprovwalk") == 0)
2312 Werror(
"system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2316 ideal arg1 = (ideal)
h->Data();
2319 int arg4 = (int) ((
long)(
h->next->next->next->Data()));
2330 if (strcmp(sys_cmd,
"TranMrImprovwalk") == 0)
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)
2339 WerrorS(
"system(\"TranMrImprovwalk\", ideal, intvec, intvec) expected");
2345 Werror(
"system(\"TranMrImprovwalk\" ...) intvecs not of length %d\n",
currRing->N);
2348 ideal arg1 = (ideal)
h->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);
2364 #ifndef MAKE_DISTRIBUTION
2375#ifdef HAVE_EXTENDED_SYSTEM
2379# include "hc_newton.h"
2386 char *sys_cmd=(
char *)(
h->Data());
2389 if(strcmp(sys_cmd,
"locNF")==0)
2394 poly
f=(poly)
h->Data();
2396 ideal
m=(ideal)
h->Data();
2399 int n=(int)((
long)
h->Data());
2464 if(strcmp(sys_cmd,
"p")==0)
2469 WarnS(
"Sorry: not available for release build!");
2475 if(strcmp(sys_cmd,
"setsyzcomp")==0)
2479 int k = (int)(
long)
h->Data();
2487 if(strcmp(sys_cmd,
"r")==0)
2492 WarnS(
"Sorry: not available for release build!");
2504 if(strcmp(sys_cmd,
"changeRing")==0)
2508 for (
int i = 1;
i <= varN;
i++)
2511 snprintf(
h,10,
"x%d",
i);
2516 res->data = (
void*)0L;
2521 if(strcmp(sys_cmd,
"mtrack")==0)
2532 char *fn=(
char*)
h->Data();
2533 fd = fopen(fn,
"w");
2535 Warn(
"Can not open %s for writing og mtrack. Using stdout",fn);
2539 max = (int)(
long)
h->Data();
2548 WerrorS(
"system(\"mtrack\",..) is not implemented in this version");
2555 if(strcmp(sys_cmd,
"backtrace")==0)
2563#if !defined(OM_NDEBUG)
2565 if (strcmp(sys_cmd,
"omMemoryTest")==0)
2569 PrintS(
"\n[om_Info]: \n");
2571#define OM_PRINT(name) Print(" %-22s : %10ld \n", #name, om_Info . name)
2572 OM_PRINT(MaxBytesSystem);
2573 OM_PRINT(CurrentBytesSystem);
2574 OM_PRINT(MaxBytesSbrk);
2575 OM_PRINT(CurrentBytesSbrk);
2576 OM_PRINT(MaxBytesMmap);
2577 OM_PRINT(CurrentBytesMmap);
2578 OM_PRINT(UsedBytes);
2579 OM_PRINT(AvailBytes);
2580 OM_PRINT(UsedBytesMalloc);
2581 OM_PRINT(AvailBytesMalloc);
2582 OM_PRINT(MaxBytesFromMalloc);
2583 OM_PRINT(CurrentBytesFromMalloc);
2584 OM_PRINT(MaxBytesFromValloc);
2585 OM_PRINT(CurrentBytesFromValloc);
2586 OM_PRINT(UsedBytesFromValloc);
2587 OM_PRINT(AvailBytesFromValloc);
2589 OM_PRINT(UsedPages);
2590 OM_PRINT(AvailPages);
2591 OM_PRINT(MaxRegionsAlloc);
2592 OM_PRINT(CurrentRegionsAlloc);
2597 PrintS(
"\n[om_Opts]: \n");
2598#define OM_PRINT(format, name) Print(" %-22s : %10" format"\n", #name, om_Opts . name)
2599 OM_PRINT(
"d", MinTrack);
2600 OM_PRINT(
"d", MinCheck);
2601 OM_PRINT(
"d", MaxTrack);
2602 OM_PRINT(
"d", MaxCheck);
2603 OM_PRINT(
"d", Keep);
2604 OM_PRINT(
"d", HowToReportErrors);
2605 OM_PRINT(
"d", MarkAsStatic);
2606 OM_PRINT(
"u", PagesPerRegion);
2607 OM_PRINT(
"p", OutOfMemoryFunc);
2608 OM_PRINT(
"p", MemoryLowFunc);
2609 OM_PRINT(
"p", ErrorHook);
2614 Print(
"\n\n[om_ErrorStatus] : '%s' (%s)\n",
2617 Print(
"[om_InternalErrorStatus]: '%s' (%s)\n",
2631 if(strcmp(sys_cmd,
"red")==0)
2646 if(strcmp(sys_cmd,
"fastcomb")==0)
2654 WarnS(
"Wrong types for poly= comb(ideal,poly)");
2659 (ideal)
h->Data(),(poly)
h->next->Data());
2667 if(strcmp(sys_cmd,
"comb")==0)
2675 WarnS(
"Wrong types for poly= comb(ideal,poly)");
2680 (ideal)
h->Data(),(poly)
h->next->Data());
2689 if(strcmp(sys_cmd,
"listall")==0)
2691 void listall(
int showproc);
2693 if ((
h!=
NULL) && (
h->Typ()==
INT_CMD)) showproc=(int)((
long)
h->Data());
2701 if(strcmp(sys_cmd,
"proclist")==0)
2703 void piShowProcList();
2711 if(strcmp(sys_cmd,
"newton")==0)
2715 || (
h->next->next->Typ()!=
INT_CMD))
2717 WerrorS(
"system(\"newton\",<poly>,<int>,<int>) expected");
2720 poly
p=(poly)(
h->Data());
2739 (
int) (
h->next->Data()),
2740 (
int) (
h->next->next->Data())
2753 L->
m[1].
data=(
void *)(
long)r.achse;
2755 L->
m[2].
data=(
void *)(
long)r.deg;
2759 L->
m[3].
data=(
void *)(
long)r.anz_punkte;
2761 int anz = r.anz_punkte;
2764 for (
i=0;
i<anz*
dim;
i++)
2774 (*w)[
i] = r.deg_tab[
i];
2777 while (r.deg_tab[
i-1] != -2);
2788 res->data=(
void *)L;
2811 if (strcmp(sys_cmd,
"minpoly") == 0)
2815 Werror(
"expected exactly one argument: %s",
2816 "a square matrix with number entries");
2826 WerrorS(
"expected exactly one argument: "
2827 "a square matrix with number entries");
2834 res->data = (
void *)theMinPoly;
2835 for (
int i = 0;
i < n;
i++)
delete[] ml[
i];
2837 delete[] polyCoeffs;
2844 if (strcmp(sys_cmd,
"sdb_flags") == 0)
2852 WerrorS(
"system(\"sdb_flags\",`int`) expected");
2861 if (strcmp(sys_cmd,
"sdb_edit") == 0)
2865 WerrorS(
"shell execution is disallowed in restricted mode");
2875 WerrorS(
"system(\"sdb_edit\",`proc`) expected");
2884 if (strcmp(sys_cmd,
"GF") == 0)
2901 if (strcmp(sys_cmd,
"svd") == 0)
2911 if (strcmp(sys_cmd,
"redNF_ring")==0)
2914 poly
f = (poly)
h->Data();
2916 ideal
G = (ideal)
h->Data();
2923 if (strcmp(sys_cmd,
"NF_ring")==0)
2926 poly
f = (poly)
h->Data();
2928 ideal
G = (ideal)
h->Data();
2934 if (strcmp(sys_cmd,
"spoly")==0)
2936 poly
f =
pCopy((poly)
h->Data());
2938 poly
g =
pCopy((poly)
h->Data());
2945 if (strcmp(sys_cmd,
"testGB")==0)
2947 ideal I = (ideal)
h->Data();
2949 ideal GI = (ideal)
h->Data();
2951 res->data = (
void *)(
long)
testGB(I, GI);
2957 if ( (strcmp(sys_cmd,
"AltVarStart") == 0) || (strcmp(sys_cmd,
"AltVarEnd") == 0) )
2963 WerrorS(
"`system(\"AltVarStart/End\"[,<ring>])` expected");
2971 if(strcmp(sys_cmd,
"AltVarStart") == 0)
2978 WerrorS(
"`system(\"AltVarStart/End\",<ring>) requires a SCA ring");
2984 #ifdef HAVE_RATGRING
2985 if (strcmp(sys_cmd,
"intratNF") == 0)
3000 I=(ideal)
h->CopyD();
3008 is=(int)((
long)(
h->Data()));
3016 for(
k=0;
k < id;
k++)
3020 PrintS(
"starting redRat\n");
3038 if (strcmp(sys_cmd,
"ratNF") == 0)
3057 is=(int)((
long)(
h->Data()));
3072 if (strcmp(sys_cmd,
"ratSpoly") == 0)
3090 is=(int)((
long)(
h->Data()));
3106 if (strcmp(sys_cmd,
"ratVar") == 0)
3123 return (start==0)||(end==0)||(start>end);
3127 if (strcmp(sys_cmd,
"unifastmult")==0)
3129 poly
f = (poly)
h->Data();
3131 poly
g=(poly)
h->Data();
3137 if (strcmp(sys_cmd,
"multifastmult")==0)
3139 poly
f = (poly)
h->Data();
3141 poly
g=(poly)
h->Data();
3147 if (strcmp(sys_cmd,
"mults")==0)
3154 if (strcmp(sys_cmd,
"fastpower")==0)
3157 poly
f = (poly)
h->Data();
3159 int n=(int)((
long)
h->Data());
3165 if (strcmp(sys_cmd,
"normalpower")==0)
3167 poly
f = (poly)
h->Data();
3169 int n=(int)((
long)
h->Data());
3175 if (strcmp(sys_cmd,
"MCpower")==0)
3178 poly
f = (poly)
h->Data();
3180 int n=(int)((
long)
h->Data());
3186 if (strcmp(sys_cmd,
"bit_subst")==0)
3189 poly outer = (poly)
h->Data();
3191 poly inner=(poly)
h->Data();
3198 if (strcmp(sys_cmd,
"gcd") == 0)
3218 int d=(int)(
long)
h->next->Data();
3219 char *
s=(
char *)
h->Data();
3237 if (strcmp(sys_cmd,
"subring") == 0)
3251 if (strcmp(sys_cmd,
"HNF") == 0)
3273 WerrorS(
"expected `system(\"HNF\",<matrix|intmat|bigintmat>)`");
3281 if (strcmp (sys_cmd,
"probIrredTest") == 0)
3286 char *
s=(
char *)
h->next->Data();
3298 if(strcmp(sys_cmd,
"GNUmpLoad")==0)
3302 char* filename = (
char*)
h->Data();
3303 FILE*
f = fopen(filename,
"r");
3306 WerrorS(
"invalid file name (in paths use '/')");
3309 mpz_t
m; mpz_init(
m);
3310 mpz_inp_str(
m,
f, 10);
3314 res->data = (
void*)n;
3319 WerrorS(
"expected valid file name as a string");
3331 if(strcmp(sys_cmd,
"intvecMatchingSegments")==0)
3335 (
h->next->next ==
NULL))
3340 int validEntries = 0;
3341 for (
int k = 0;
k <= ivec->
rows() - jvec->
rows();
k++)
3343 if (memcmp(&(*ivec)[
k], &(*jvec)[0],
3344 sizeof(
int) * jvec->
rows()) == 0)
3346 if (validEntries == 0)
3350 r->
resize(validEntries + 1);
3351 (*r)[validEntries] =
k + 1;
3357 res->data = (
void*)r;
3362 WerrorS(
"expected two non-empty intvecs as arguments");
3373 if(strcmp(sys_cmd,
"intvecOverlap")==0)
3377 (
h->next->next ==
NULL))
3381 int ir = ivec->
rows();
int jr = jvec->
rows();
3382 int r = jr;
if (ir < jr) r = ir;
3383 while ((r >= 1) && (memcmp(&(*ivec)[ir - r], &(*jvec)[0],
3384 sizeof(
int) * r) != 0))
3387 res->data = (
void*)(
long)r;
3392 WerrorS(
"expected two non-empty intvecs as arguments");
3398 if(strcmp(sys_cmd,
"henselfactors")==0)
3403 (
h->next->next->next !=
NULL) &&
3404 (
h->next->next->next->Typ() ==
POLY_CMD) &&
3405 (
h->next->next->next->next !=
NULL) &&
3406 (
h->next->next->next->next->Typ() ==
POLY_CMD) &&
3407 (
h->next->next->next->next->next !=
NULL) &&
3408 (
h->next->next->next->next->next->Typ() ==
INT_CMD) &&
3409 (
h->next->next->next->next->next->next ==
NULL))
3411 int xIndex = (int)(
long)
h->Data();
3412 int yIndex = (int)(
long)
h->next->Data();
3413 poly hh = (poly)
h->next->next->Data();
3414 poly f0 = (poly)
h->next->next->next->Data();
3415 poly g0 = (poly)
h->next->next->next->next->Data();
3416 int d = (int)(
long)
h->next->next->next->next->next->Data();
3424 res->data = (
char *)L;
3429 WerrorS(
"expected argument list (int, int, poly, poly, poly, int)");
3436 if (strcmp(sys_cmd,
"astep") == 0)
3441 I=(ideal)
h->CopyD();
3454 if (strcmp(sys_cmd,
"PrintMat") == 0)
3464 a=(int)((
long)(
h->Data()));
3469 b=(int)((
long)(
h->Data()));
3484 metric=(int)((
long)(
h->Data()));
3495 if(strcmp(sys_cmd,
"NCUseExtensions")==0)
3508 if(strcmp(sys_cmd,
"NCGetType")==0)
3514 res->data=(
void *)(-1L);
3521 if(strcmp(sys_cmd,
"ForceSCA")==0)
3528 b = (int)((
long)(
h->Data()));
3534 e = (int)((
long)(
h->Data()));
3545 if(strcmp(sys_cmd,
"ForceNewNCMultiplication")==0)
3557 if(strcmp(sys_cmd,
"ForceNewOldNCMultiplication")==0)
3569 if(strcmp(sys_cmd,
"test64")==0)
3585 Print(
"SIZEOF_LONG=%d\n",SIZEOF_LONG);
3591 if(strcmp(sys_cmd,
"cache_chinrem")==0)
3602 if(strcmp(sys_cmd,
"LU")==0)
3612 res->data=(
char*)bb;
3617 WerrorS(
"system(\"LU\",<cmatrix>) expected");
3624 if(strcmp(sys_cmd,
"sort")==0)
3634 if(strcmp(sys_cmd,
"uniq")==0)
3644 if(strcmp(sys_cmd,
"GF")==0)
3649 int p=(int)(
long)
h->Data();
3650 int n=(int)(
long)
h->next->Data();
3651 char *
v=(
char*)
h->next->next->CopyD();
3667 if(strcmp(sys_cmd,
"power1")==0)
3670 poly
f=(poly)
h->CopyD();
3672 res->data=(
void *)
g;
3676 if(strcmp(sys_cmd,
"power2")==0)
3679 poly
f=(poly)
h->Data();
3681 for(
int i=0;
i<2000;
i++)
3683 res->data=(
void *)
g;
3686 if(strcmp(sys_cmd,
"power3")==0)
3689 poly
f=(poly)
h->Data();
3700 poly p1536=
pMult(p1024,p512);
3701 poly p1792=
pMult(p1536,p256);
3702 poly p1920=
pMult(p1792,p128);
3703 poly p1984=
pMult(p1920,p64);
3704 poly p2000=
pMult(p1984,p16);
3705 res->data=(
void *)p2000;
3725#if defined(HAVE_CCLUSTER) && defined(HAVE_FLINT)
3726 if(strcmp(sys_cmd,
"ccluster")==0)
3736 int pol_with_complex_coeffs=0;
3738 pol_with_complex_coeffs=1;
3744 fmpq_poly_t fre, fim;
3746 if (pol_with_complex_coeffs==1)
3751 fmpq_t center_re,center_im,boxsize,eps;
3757 int n=fmpq_poly_length(fre);
3758 fmpq_t* re_part=(fmpq_t*)
omAlloc(n*
sizeof(fmpq_t));
3759 fmpq_t* im_part=(fmpq_t*)
omAlloc(n*
sizeof(fmpq_t));
3761 for(
int i=0;
i<n;
i++)
3762 { fmpq_init(re_part[
i]); fmpq_init(im_part[
i]); }
3767 long nb_threads = (long)
feOptValue(FE_OPT_CPUS);
3768 strategy = strategy+(nb_threads<<6);
3771 if (pol_with_complex_coeffs==0)
3772 nn=ccluster_interface_poly_real(re_part,im_part,
mult,fre,center_re,center_im,boxsize,eps,strategy,verbosity);
3774 nn=ccluster_interface_poly_real_imag(re_part,im_part,
mult,fre,fim,center_re,center_im,boxsize,eps,strategy,verbosity);
3778 for(
int i=0;
i<nn;
i++)
3792 for(
int i=n-1;
i>=0;
i--) { fmpq_clear(re_part[
i]); fmpq_clear(im_part[
i]); }
3796 fmpq_clear(center_re); fmpq_clear(center_im); fmpq_clear(boxsize); fmpq_clear(eps);
3797 fmpq_poly_clear(fre);
3798 if (pol_with_complex_coeffs==1) fmpq_poly_clear(fim);
3810 if(strcmp(sys_cmd,
"evaluate")==0)
3812 extern number
maEvalAt(
const poly
p,
const number* pt,
const ring r);
3815 WerrorS(
"expected system(\"evaluate\",<poly>,..)");
3818 poly
p=(poly)
h->Data();
3825 WerrorS(
"system(\"evaluate\",<poly>,<number>..) - expect number");
3828 pt[
i]=(number)
h->Data();
3836 if(strcmp(sys_cmd,
"DivRem")==0)
3841 poly
p=(poly)
h->CopyD();
3842 poly q=(poly)
h->next->CopyD();
3851 WerrorS(
"expected system(\"DivRem\",<poly>,<poly>)");
3857 if(strcmp(sys_cmd,
"DivRemIdU")==0)
3864 ideal
p=(ideal)
h->CopyD();
3865 ideal q=(ideal)
h->next->CopyD();
3868 ideal rest=
idDivRem(
p,q,factors,&unit,0);
3883 WerrorS(
"expected system(\"DivRemId\",<ideal>,<ideal>)");
3888 if(strcmp(sys_cmd,
"DivRemId")==0)
3895 ideal
p=(ideal)
h->CopyD();
3896 ideal q=(ideal)
h->next->CopyD();
3910 WerrorS(
"expected system(\"DivRemId\",<ideal>,<ideal>)");
3916 if(strcmp(sys_cmd,
"CoeffTerm")==0)
3929 poly
p=(poly)
h->Data();
3930 poly q=(poly)
h->next->Data();
3938 ideal
p=(ideal)
h->Data();
3939 poly q=(poly)
h->next->Data();
3946 poly
p=(poly)
h->Data();
3947 poly q=(poly)
h->next->Data();
3954 ideal
p=(ideal)
h->Data();
3955 poly q=(poly)
h->next->Data();
3962 poly
p=(poly)
h->Data();
3963 ideal q=(ideal)
h->next->Data();
3970 poly
p=(poly)
h->Data();
3971 ideal q=(ideal)
h->next->Data();
3978 WerrorS(
"expected system(\"CoeffTerm\",<poly>/<vector>,<poly>/<vector>)" "\n or <ideal>/<module>,<poly>/<vector>");
3984 if(strcmp(sys_cmd,
"sat1")==0)
3986 ideal I= (ideal)
h->Data();
3987 ideal J=(ideal)
h->next->Data();
3994 if(strcmp(sys_cmd,
"minres_with_map")==0)
4002 res->next->data=(
void*)trans;
4009 if(strcmp(sys_cmd,
"sat_with_exp")==0)
4011 ideal I= (ideal)
h->Data();
4012 ideal J=(ideal)
h->next->Data();
4027 if(strcmp(sys_cmd,
"ssi")==0)
4036 if(strcmp(sys_cmd,
"ssi-r")==0)
4040 char *
s=(
char*)
h->Data();
4042 memcpy(
res,rr,
sizeof(*rr));
4049 if(strcmp(sys_cmd,
"+=")==0)
4057 poly
p=(poly)
h->next->CopyD();
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)
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)
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_intern(ideal I, ideal J, int &k, BOOLEAN isIdeal, BOOLEAN isSB)
ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing)
STATIC_VAR coordinates * points
#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)
BOOLEAN kVerify(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)
#define omFreeBin(addr, bin)
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_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
poly p_CoeffTermMo(poly v, ideal m, const ring r)
find coeffs of a vector of a matrix(module) of given monomials
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)
void sBucket_Add_p(sBucket_pt bucket, poly p, int length)
adds poly p to bucket destroys p!
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)
void ssiWrite_S(leftv data, const ring R)
leftv ssiRead1_S(char **s, 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)