@@ -181,7 +181,7 @@ static_assert(
181181 false ,
182182 " Your Normaliz version (unknown) is too old! Update to 3.9.2 or newer." );
183183#endif
184- #if NMZ_RELEASE < 30902
184+ #if NMZ_RELEASE < 30904
185185static_assert (false ,
186186 " Your Normaliz version is too old! Update to 3.9.2 or newer." );
187187#endif
@@ -2153,6 +2153,106 @@ static PyObject* NmzSetPolynomial(PyObject* self, PyObject* args)
21532153 FUNC_END
21542154}
21552155
2156+ static PyObject* NmzSetPolynomialEquations (PyObject* self, PyObject* args)
2157+ {
2158+
2159+ FUNC_BEGIN
2160+
2161+ PyObject* cone = PyTuple_GetItem (args, 0 );
2162+
2163+ if (!is_cone (cone)) {
2164+ PyErr_SetString (PyNormaliz_cppError, " First argument must be a cone" );
2165+ return NULL ;
2166+ }
2167+
2168+ TempSignalHandler tmpHandler; // use custom signal handler
2169+
2170+ PyObject* polys_py = PyTuple_GetItem (args, 1 );
2171+ if (!PyList_CheckExact (polys_py)) {
2172+ PyErr_SetString (PyNormaliz_cppError, " Second argument must be a list" );
2173+ return NULL ;
2174+ }
2175+
2176+ TempSignalHandler tmpHandler1; // use custom signal handler
2177+
2178+ size_t nr_polys = PySequence_Size (polys_py);
2179+ vector<string> PolyEquations;
2180+ for (size_t i = 0 ; i < nr_polys; ++i){
2181+ if (!string_check (PyList_GetItem (polys_py,i))) {
2182+ PyErr_SetString (PyNormaliz_cppError, " Polynomual must be given as a string" );
2183+ return NULL ;
2184+ }
2185+ string equ = PyUnicodeToString ( PyList_GetItem (polys_py,i));
2186+ PolyEquations.push_back (equ);
2187+ }
2188+
2189+ if (is_cone_mpz (cone)) {
2190+ Cone< mpz_class >* cone_ptr = get_cone_mpz (cone);
2191+ cone_ptr->setPolynomialEquations (PolyEquations);
2192+ Py_RETURN_TRUE;
2193+ }
2194+ if (is_cone_long (cone)) {
2195+ Cone< long long >* cone_ptr = get_cone_long (cone);
2196+ cone_ptr->setPolynomialEquations (PolyEquations);
2197+ Py_RETURN_TRUE;
2198+ }
2199+ Cone<renf_elem_class>* cone_ptr = get_cone_renf (cone);
2200+ cone_ptr->setPolynomialEquations (PolyEquations);
2201+ Py_RETURN_TRUE;
2202+
2203+ FUNC_END
2204+ }
2205+
2206+ static PyObject* NmzSetPolynomialInequalities (PyObject* self, PyObject* args)
2207+ {
2208+
2209+ FUNC_BEGIN
2210+
2211+ PyObject* cone = PyTuple_GetItem (args, 0 );
2212+
2213+ if (!is_cone (cone)) {
2214+ PyErr_SetString (PyNormaliz_cppError, " First argument must be a cone" );
2215+ return NULL ;
2216+ }
2217+
2218+ TempSignalHandler tmpHandler; // use custom signal handler
2219+
2220+ PyObject* polys_py = PyTuple_GetItem (args, 1 );
2221+ if (!PyList_CheckExact (polys_py)) {
2222+ PyErr_SetString (PyNormaliz_cppError, " Second argument must be a list" );
2223+ return NULL ;
2224+ }
2225+
2226+ TempSignalHandler tmpHandler1; // use custom signal handler
2227+
2228+ size_t nr_polys = PySequence_Size (polys_py);
2229+ vector<string> PolyInequalities;
2230+ for (size_t i = 0 ; i < nr_polys; ++i){
2231+ if (!string_check (PyList_GetItem (polys_py,i))) {
2232+ PyErr_SetString (PyNormaliz_cppError, " Polynomual must be given as a string" );
2233+ return NULL ;
2234+ }
2235+ string inequ = PyUnicodeToString ( PyList_GetItem (polys_py,i));
2236+ PolyInequalities.push_back (inequ);
2237+ }
2238+
2239+ if (is_cone_mpz (cone)) {
2240+ Cone< mpz_class >* cone_ptr = get_cone_mpz (cone);
2241+ cone_ptr->setPolynomialInequalities (PolyInequalities);
2242+ Py_RETURN_TRUE;
2243+ }
2244+ if (is_cone_long (cone)) {
2245+ Cone< long long >* cone_ptr = get_cone_long (cone);
2246+ cone_ptr->setPolynomialInequalities (PolyInequalities);
2247+ Py_RETURN_TRUE;
2248+ }
2249+ Cone<renf_elem_class>* cone_ptr = get_cone_renf (cone);
2250+ cone_ptr->setPolynomialInequalities (PolyInequalities);
2251+ Py_RETURN_TRUE;
2252+
2253+ FUNC_END
2254+ }
2255+
21562256/* **************************************************************************
21572257 *
21582258 * FaceCodimBound
@@ -2655,6 +2755,8 @@ static PyObject* NmzFieldGenName(PyObject* self, PyObject* args)
26552755
26562756#endif
26572757
2758+ return NULL ; // to kmake gcc happy
2759+
26582760 FUNC_END
26592761}
26602762
@@ -2719,6 +2821,10 @@ static PyMethodDef PyNormaliz_cppMethods[] = {
27192821 METH_VARARGS, " Sets the number of decimal digits for fixed precision" },
27202822 {" NmzSetPolynomial" , (PyCFunction)NmzSetPolynomial,
27212823 METH_VARARGS, " Sets the polynomial for integration and weighted series" },
2824+ {" NmzSetPolynomialEquations" , (PyCFunction)NmzSetPolynomialEquations,
2825+ METH_VARARGS, " Sets the polynomial equations for lattice points" },
2826+ {" NmzSetPolynomialInequalities" , (PyCFunction)NmzSetPolynomialInequalities,
2827+ METH_VARARGS, " Sets the polynomial inequalities for lattice points" },
27222828 {" NmzSetFaceCodimBound" , (PyCFunction)NmzSetFaceCodimBound,
27232829 METH_VARARGS, " Sets the maximal codimension for the computed faces" },
27242830 {" NmzGetHilbertSeriesExpansion" ,
0 commit comments