Skip to content

Commit 7f0c7f3

Browse files
author
Winfried Bruns
committed
Merge branch 'master' into new_e-antic
2 parents 03ee816 + a6beff6 commit 7f0c7f3

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

NormalizModule.cpp

+42-1
Original file line numberDiff line numberDiff line change
@@ -2138,6 +2138,45 @@ static PyObject* NmzSetFaceCodimBound(PyObject* self, PyObject* args)
21382138
FUNC_END
21392139
}
21402140

2141+
static PyObject* NmzSetDecimalDigits(PyObject* self, PyObject* args)
2142+
{
2143+
2144+
FUNC_BEGIN
2145+
2146+
PyObject* cone = PyTuple_GetItem(args, 0);
2147+
2148+
if (!is_cone(cone)) {
2149+
PyErr_SetString(PyNormaliz_cppError, "First argument must be a cone");
2150+
return NULL;
2151+
}
2152+
2153+
PyObject* digits_py = PyTuple_GetItem(args, 1);
2154+
2155+
TempSignalHandler tmpHandler; // use custom signal handler
2156+
2157+
int overflow;
2158+
long digits = PyLong_AsLongLongAndOverflow(digits_py, &overflow);
2159+
if (is_cone_mpz(cone)) {
2160+
Cone< mpz_class >* cone_ptr = get_cone_mpz(cone);
2161+
cone_ptr->setDecimalDigits(digits);
2162+
Py_RETURN_TRUE;
2163+
}
2164+
else if (is_cone_long(cone)) {
2165+
Cone< long long >* cone_ptr = get_cone_long(cone);
2166+
cone_ptr->setDecimalDigits(digits);
2167+
Py_RETURN_TRUE;
2168+
}
2169+
#ifdef ENFNORMALIZ
2170+
else {
2171+
Cone<renf_elem_class>* cone_ptr = get_cone_renf(cone);
2172+
cone_ptr->setDecimalDigits(digits);
2173+
Py_RETURN_TRUE;
2174+
}
2175+
#endif
2176+
2177+
FUNC_END
2178+
}
2179+
21412180
/***************************************************************************
21422181
*
21432182
* Get Symmetrized cone
@@ -2533,7 +2572,9 @@ static PyMethodDef PyNormaliz_cppMethods[] = {
25332572
(PyCFunction)NmzSetNumberOfNormalizThreads, METH_VARARGS,
25342573
"Sets the Normaliz thread limit"},
25352574
{"NmzSetNrCoeffQuasiPol", (PyCFunction)NmzSetNrCoeffQuasiPol,
2536-
METH_VARARGS, "Sets the number of computed coefficients for the quasi-polynomial"},
2575+
METH_VARARGS, "Sets the number of computed coefficients for the quasi-polynomial"},
2576+
{"NmzSetDecimalDigits", (PyCFunction)NmzSetDecimalDigits,
2577+
METH_VARARGS, "Sets the number of decimal digits for fixed precision"},
25372578
{"NmzSetPolynomial", (PyCFunction)NmzSetPolynomial,
25382579
METH_VARARGS, "Sets the polynomial for integration and weighted series"},
25392580
{"NmzSetFaceCodimBound", (PyCFunction)NmzSetFaceCodimBound,

PyNormaliz.py

+3
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,9 @@ def SetNrCoeffQuasiPol(self, bound=-1):
387387
def SetFaceCodimBound(self, bound=-1):
388388
return PyNormaliz_cpp.NmzSetFaceCodimBound(self.cone, bound)
389389

390+
def SetDecimalDigits(self, digits=100):
391+
return PyNormaliz_cpp.NmzSetDecimalDigits(self.cone, digits)
392+
390393
def SetPolynomial(self, poly =""):
391394
return PyNormaliz_cpp.NmzSetPolynomial(self.cone, poly)
392395

0 commit comments

Comments
 (0)