Skip to content

Commit e323ef1

Browse files
committed
Towards 2.21
1 parent dbd5e83 commit e323ef1

File tree

3 files changed

+52
-5
lines changed

3 files changed

+52
-5
lines changed

NormalizModule.cpp

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@ static PyObject* CallPythonFuncOnOneArg(PyObject* function, PyObject* single_arg
180180
#ifndef NMZ_RELEASE
181181
static_assert(
182182
false,
183-
"Your Normaliz version (unknown) is too old! Update to 3.10.3 or newer.");
183+
"Your Normaliz version (unknown) is too old! Update to 3.10.4 or newer.");
184184
#endif
185-
#if NMZ_RELEASE < 31003
185+
#if NMZ_RELEASE < 31004
186186
static_assert(false,
187-
"Your Normaliz version is too old! Update to 3.10.3 or newer.");
187+
"Your Normaliz version is too old! Update to 3.10.4 or newer.");
188188
#endif
189189

190190
/***************************************************************************
@@ -1899,6 +1899,9 @@ _NmzResultImpl(Cone< Integer >* C, PyObject* prop_obj, const void* nf = nullptr)
18991899
case libnormaliz::ConeProperty::FusionData:
19001900
return NmzFusionDataToPython(C->getFusionDataMatrix());
19011901

1902+
case libnormaliz::ConeProperty::InductionMatrices:
1903+
return NmzFusionDataToPython(C->getInductionMatrices());
1904+
19021905
case libnormaliz::ConeProperty::Incidence:
19031906
return NmzVectorToPyList(C->getIncidence());
19041907

@@ -2401,6 +2404,45 @@ static PyObject* NmzSetModularGrading(PyObject* self, PyObject* args)
24012404
FUNC_END
24022405
}
24032406

2407+
static PyObject* NmzSetChosenFusionRing(PyObject* self, PyObject* args)
2408+
{
2409+
2410+
FUNC_BEGIN
2411+
2412+
PyObject* cone = PyTuple_GetItem(args, 0);
2413+
2414+
if (!is_cone(cone)) {
2415+
PyErr_SetString(PyNormaliz_cppError, "First argument must be a cone");
2416+
return NULL;
2417+
}
2418+
2419+
PyObject* chosen_ring_py = PyTuple_GetItem(args, 1);
2420+
2421+
TempSignalHandler tmpHandler; // use custom signal handler
2422+
2423+
int overflow;
2424+
long chosen_ring = PyLong_AsLongLongAndOverflow(chosen_ring_py, &overflow);
2425+
if (is_cone_mpz(cone)) {
2426+
Cone< mpz_class >* cone_ptr = get_cone_mpz(cone);
2427+
cone_ptr->setChosenFusionRing(chosen_ring);
2428+
Py_RETURN_TRUE;
2429+
}
2430+
else if (is_cone_long(cone)) {
2431+
Cone< long long >* cone_ptr = get_cone_long(cone);
2432+
cone_ptr->setChosenFusionRing(chosen_ring);
2433+
Py_RETURN_TRUE;
2434+
}
2435+
#ifdef ENFNORMALIZ
2436+
else {
2437+
Cone<renf_elem_class>* cone_ptr = get_cone_renf(cone);
2438+
cone_ptr->setChosenFusionRing(chosen_ring);
2439+
Py_RETURN_TRUE;
2440+
}
2441+
#endif
2442+
2443+
FUNC_END
2444+
}
2445+
24042446
static PyObject* NmzSetGBDegreeBound(PyObject* self, PyObject* args)
24052447
{
24062448

@@ -3007,7 +3049,9 @@ static PyMethodDef PyNormaliz_cppMethods[] = {
30073049
{"NmzSetFaceCodimBound", (PyCFunction)NmzSetFaceCodimBound,
30083050
METH_VARARGS, "Sets the maximal codimension for the computed faces"},
30093051
{"NmzSetModularGrading", (PyCFunction)NmzSetModularGrading,
3010-
METH_VARARGS, "Picks a modular grading (counting from 1)"},
3052+
METH_VARARGS, "Sets the maximal codimension for the computed faces"},
3053+
{"NmzSetChosenFusionRing", (PyCFunction)NmzSetChosenFusionRing,
3054+
METH_VARARGS, "Picks a fusion ring (counting from 1)"},
30113055
{"NmzSetGBDegreeBound", (PyCFunction)NmzSetGBDegreeBound,
30123056
METH_VARARGS, "Sets the maximal degree for binomials in Gröbner and Markov bases"},
30133057
{"NmzSetGBMinDegree", (PyCFunction)NmzSetGBMinDegree,

PyNormaliz.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ def SetFaceCodimBound(self, bound=-1):
388388
def SetModularGrading(self, mod_gr=-1):
389389
return PyNormaliz_cpp.NmzSetModularGrading(self.cone, mod_gr)
390390

391+
def SetChosenFusionRing(self, chosen_ring=-1):
392+
return PyNormaliz_cpp.NmzSetChosenFusionRing(self.cone, chosen_ring)
393+
391394
def SetGBDegreeBound(self, bound=-1):
392395
return PyNormaliz_cpp.NmzSetGBDegreeBound(self.cone, bound)
393396

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = PyNormaliz
3-
version = 2.20
3+
version = 2.21
44
description = An interface to Normaliz
55
author = Sebastian Gutsche, Richard Sieg, Winfried Bruns
66
author_email = wbruns@uos.de

0 commit comments

Comments
 (0)