@@ -179,11 +179,11 @@ static PyObject* CallPythonFuncOnOneArg(PyObject* function, PyObject* single_arg
179179#ifndef NMZ_RELEASE
180180static_assert (
181181 false ,
182- " Your Normaliz version (unknown) is too old! Update to 3.9.2 or newer." );
182+ " Your Normaliz version (unknown) is too old! Update to 3.10.0 or newer." );
183183#endif
184- #if NMZ_RELEASE < 30904
184+ #if NMZ_RELEASE < 31000
185185static_assert (false ,
186- " Your Normaliz version is too old! Update to 3.9.2 or newer." );
186+ " Your Normaliz version is too old! Update to 3.10.0 or newer." );
187187#endif
188188
189189/* **************************************************************************
@@ -1101,16 +1101,16 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
11011101
11021102static PyObject* _NmzConeFromFile (PyObject* kwargs)
11031103{
1104-
1104+
11051105 static const char * from_file = " file" ;
1106- PyObject* create_from_file = StringToPyUnicode (from_file);
1106+ PyObject* create_from_file = StringToPyUnicode (from_file);
11071107 PyObject* FileName = PyDict_GetItem (kwargs, create_from_file);
11081108 string project (PyUnicodeToString (FileName));
1109-
1109+
11101110 std::string name_in = project + " .in" ;
11111111 const char * file_in = name_in.c_str ();
11121112
1113- #ifdef ENFNORMALIZ
1113+ #ifdef ENFNORMALIZ
11141114 std::ifstream in;
11151115 in.open (file_in, std::ifstream::in);
11161116 if (!in.is_open ()) {
@@ -1129,19 +1129,19 @@ static PyObject* _NmzConeFromFile(PyObject* kwargs)
11291129 }
11301130 }
11311131 in.close ();
1132-
1132+
11331133 if (number_field_in_input){
11341134 boost::intrusive_ptr<const renf_class> renf = renf_class::make (poly, var, emb);
11351135 const renf_class* my_renf = renf.get ();
11361136 Cone< renf_elem_class >* C = new Cone< renf_elem_class >(project);
11371137 PyObject* return_container = pack_cone (C, my_renf);
11381138 return return_container;
1139- }
1139+ }
11401140#endif
11411141
11421142 static const char * string_for_long_long = " CreateAsLongLong" ;
11431143 PyObject* create_as_long_long = StringToPyUnicode (string_for_long_long);
1144-
1144+
11451145 if (PyDict_Contains (kwargs, create_as_long_long) == 1 ) {
11461146 Cone< long long >* C = new Cone< long long >(project);
11471147 PyObject* return_container = pack_cone (C);
@@ -1150,7 +1150,7 @@ static PyObject* _NmzConeFromFile(PyObject* kwargs)
11501150 else {
11511151 Cone< mpz_class >* C = new Cone< mpz_class >(project);
11521152 PyObject* return_container = pack_cone (C);
1153- return return_container;
1153+ return return_container;
11541154 }
11551155}
11561156
@@ -1174,7 +1174,7 @@ static PyObject* _NmzCone(PyObject* self, PyObject* args, PyObject* kwargs)
11741174 if (kwargs != NULL && PyDict_Contains (kwargs, create_from_file) == 1 ) {
11751175 return _NmzConeFromFile (kwargs);
11761176 }
1177-
1177+
11781178 static const char * string_for_long = " CreateAsLongLong" ;
11791179 PyObject* create_as_long_long = StringToPyUnicode (string_for_long);
11801180#ifdef ENFNORMALIZ
@@ -2172,9 +2172,9 @@ static PyObject* NmzSetPolynomialEquations(PyObject* self, PyObject* args)
21722172 PyErr_SetString (PyNormaliz_cppError, " Second argument must be a list" );
21732173 return NULL ;
21742174 }
2175-
2175+
21762176 TempSignalHandler tmpHandler1; // use custom signal handler
2177-
2177+
21782178 size_t nr_polys = PySequence_Size (polys_py);
21792179 vector<string> PolyEquations;
21802180 for (size_t i = 0 ; i < nr_polys; ++i){
@@ -2224,9 +2224,9 @@ static PyObject* NmzSetPolynomialInequalities(PyObject* self, PyObject* args)
22242224 PyErr_SetString (PyNormaliz_cppError, " Second argument must be a list" );
22252225 return NULL ;
22262226 }
2227-
2227+
22282228 TempSignalHandler tmpHandler1; // use custom signal handler
2229-
2229+
22302230 size_t nr_polys = PySequence_Size (polys_py);
22312231 vector<string> PolyInequalities;
22322232 for (size_t i = 0 ; i < nr_polys; ++i){
@@ -2253,7 +2253,7 @@ static PyObject* NmzSetPolynomialInequalities(PyObject* self, PyObject* args)
22532253 cone_ptr->setPolynomialInequalities (PolyInequalities);
22542254 Py_RETURN_TRUE;
22552255#endif
2256-
2256+
22572257 FUNC_END
22582258}
22592259
@@ -2302,6 +2302,81 @@ static PyObject* NmzSetFaceCodimBound(PyObject* self, PyObject* args)
23022302 FUNC_END
23032303}
23042304
2305+ static PyObject* NmzSetGBDegreeBound (PyObject* self, PyObject* args)
2306+ {
2307+
2308+ FUNC_BEGIN
2309+
2310+ PyObject* cone = PyTuple_GetItem (args, 0 );
2311+
2312+ if (!is_cone (cone)) {
2313+ PyErr_SetString (PyNormaliz_cppError, " First argument must be a cone" );
2314+ return NULL ;
2315+ }
2316+
2317+ PyObject* bound_py = PyTuple_GetItem (args, 1 );
2318+
2319+ TempSignalHandler tmpHandler; // use custom signal handler
2320+
2321+ int overflow;
2322+ long bound = PyLong_AsLongLongAndOverflow (bound_py, &overflow);
2323+ if (is_cone_mpz (cone)) {
2324+ Cone< mpz_class >* cone_ptr = get_cone_mpz (cone);
2325+ cone_ptr->setGBDegreeBound (bound);
2326+ Py_RETURN_TRUE;
2327+ }
2328+ else if (is_cone_long (cone)) {
2329+ Cone< long long >* cone_ptr = get_cone_long (cone);
2330+ cone_ptr->setGBDegreeBound (bound);
2331+ Py_RETURN_TRUE;
2332+ }
2333+ #ifdef ENFNORMALIZ
2334+ else {
2335+ PyErr_SetString (PyNormaliz_cppError, " GB degree bound not defined for algebraic polyhedra" );
2336+ return NULL ;
2337+ }
2338+ #endif
2339+
2340+ FUNC_END
2341+ }
2342+
2343+ static PyObject* NmzSetGBMinDegree (PyObject* self, PyObject* args)
2344+ {
2345+
2346+ FUNC_BEGIN
2347+
2348+ PyObject* cone = PyTuple_GetItem (args, 0 );
2349+
2350+ if (!is_cone (cone)) {
2351+ PyErr_SetString (PyNormaliz_cppError, " First argument must be a cone" );
2352+ return NULL ;
2353+ }
2354+
2355+ PyObject* bound_py = PyTuple_GetItem (args, 1 );
2356+
2357+ TempSignalHandler tmpHandler; // use custom signal handler
2358+
2359+ int overflow;
2360+ long bound = PyLong_AsLongLongAndOverflow (bound_py, &overflow);
2361+ if (is_cone_mpz (cone)) {
2362+ Cone< mpz_class >* cone_ptr = get_cone_mpz (cone);
2363+ cone_ptr->setGBMinDegree (bound);
2364+ Py_RETURN_TRUE;
2365+ }
2366+ else if (is_cone_long (cone)) {
2367+ Cone< long long >* cone_ptr = get_cone_long (cone);
2368+ cone_ptr->setGBMinDegree (bound);
2369+ }
2370+ #ifdef ENFNORMALIZ
2371+ else {
2372+ PyErr_SetString (PyNormaliz_cppError, " GB min degree not defined for algebraic polyhedra" );
2373+ return NULL ;
2374+ }
2375+ #endif
2376+
2377+ FUNC_END
2378+ }
2379+
23052380static PyObject* NmzSetDecimalDigits (PyObject* self, PyObject* args)
23062381{
23072382
@@ -2710,7 +2785,7 @@ static PyObject* NmzGetRenfInfo(PyObject* self, PyObject* args)
27102785 );
27112786 return NULL ;
27122787 }
2713-
2788+
27142789 const renf_class* renf = get_cone_renf_renf (cone_py);
27152790 std::string minpoly_str;
27162791 minpoly_str = fmpq_poly_get_str_pretty (renf->get_renf ()->nf ->pol , renf->gen_name ().c_str ());
@@ -2741,9 +2816,9 @@ static PyObject* NmzFieldGenName(PyObject* self, PyObject* args)
27412816 return NULL ;
27422817 }
27432818 PyObject* cone_py = PyTuple_GetItem (args, 0 );
2744-
2819+
27452820 std::string gen_name_string = " " ;
2746-
2821+
27472822 if (is_cone_mpz (cone_py)) {
27482823 return PyUnicode_FromString (gen_name_string.c_str ());
27492824 }
@@ -2755,8 +2830,8 @@ static PyObject* NmzFieldGenName(PyObject* self, PyObject* args)
27552830 Cone< renf_elem_class >* cone_ptr = get_cone_renf (cone_py);
27562831 gen_name_string = cone_ptr->getRenfGenerator ();
27572832 return PyUnicode_FromString (gen_name_string.c_str ());
2758- }
2759-
2833+ }
2834+
27602835#endif
27612836
27622837 return NULL ; // to kmake gcc happy
@@ -2831,6 +2906,10 @@ static PyMethodDef PyNormaliz_cppMethods[] = {
28312906 METH_VARARGS, " Sets the polynomial inequalities for lattice points" },
28322907 {" NmzSetFaceCodimBound" , (PyCFunction)NmzSetFaceCodimBound,
28332908 METH_VARARGS, " Sets the maximal codimension for the computed faces" },
2909+ {" NmzSetGBDegreeBound" , (PyCFunction)NmzSetGBDegreeBound,
2910+ METH_VARARGS, " Sets the maximal degree for binomials in Gröbner and Markov bases" },
2911+ {" NmzSetGBMinDegree" , (PyCFunction)NmzSetGBMinDegree,
2912+ METH_VARARGS, " Sets the minimal degree for binomials in Gröbner and Markov bases" },
28342913 {" NmzGetHilbertSeriesExpansion" ,
28352914 (PyCFunction)NmzGetHilbertSeriesExpansion, METH_VARARGS,
28362915 " Returns expansion of the hilbert series" },
@@ -2854,12 +2933,12 @@ static PyMethodDef PyNormaliz_cppMethods[] = {
28542933 " Prints the Normaliz cone output into a file" },
28552934 {" NmzWritePrecompData" , (PyCFunction)NmzWritePrecompData, METH_VARARGS,
28562935 " Prints the Normaliz cone precomputed data for further input" },
2857-
2936+
28582937 {" NmzGetRenfInfo" , (PyCFunction)NmzGetRenfInfo, METH_VARARGS,
28592938 " Outputs info of the number field associated to a renf cone" },
28602939 {" NmzFieldGenName" , (PyCFunction)NmzFieldGenName, METH_VARARGS,
28612940 " Returns name of field generator" },
2862-
2941+
28632942 {" NmzModifyCone" , (PyCFunction)_NmzModify_Outer, METH_VARARGS,
28642943 " Modifies a given input property of a cone using a new matrix" },
28652944 {
0 commit comments