@@ -18,11 +18,6 @@ using std::string;
1818
1919#include < libnormaliz/libnormaliz.h>
2020
21- #ifdef ENFNORMALIZ
22- using eantic::renf_elem_class;
23- using eantic::renf_class;
24- #endif
25-
2621using libnormaliz::Cone;
2722// using libnormaliz::ConeProperty;
2823using libnormaliz::ConeProperties;
@@ -473,10 +468,11 @@ static bool prepare_nf_input(vector< vector< NumberFieldElem > >& out,
473468 if (!current_res) {
474469 return false ;
475470 }
476- current_elem = renf_elem_class (nf-> shared_from_this (), current_vector);
471+ current_elem = NumberFieldElem (*nf, current_vector);
477472 }
478473 if (string_check (current_element)) {
479- current_elem =renf_elem_class (nf->shared_from_this (),PyUnicodeToString (current_element));
474+ current_elem = NumberFieldElem (*nf);
475+ current_elem = PyUnicodeToString (current_element);
480476 }
481477 if (PyFloat_Check (current_element)){
482478 throw PyNormalizInputException (" Nonintegral numbers must be given as strings" );
@@ -746,7 +742,7 @@ NmzAutomorphismsToPython(const AutomorphismGroup< Integer >& grp)
746742
747743#ifdef ENFNORMALIZ
748744struct NumberFieldCone {
749- const renf_class* nf;
745+ renf_class* nf;
750746 Cone< renf_elem_class >* cone;
751747};
752748#endif
@@ -795,31 +791,31 @@ static Cone< renf_elem_class >* get_cone_renf(PyObject* cone)
795791 return cone_ptr->cone ;
796792}
797793
798- static const renf_class* get_cone_renf_renf (PyObject* cone)
794+ static renf_class* get_cone_renf_renf (PyObject* cone)
799795{
800796 NumberFieldCone* cone_ptr = reinterpret_cast < NumberFieldCone* >(
801797 PyCapsule_GetPointer (cone, cone_name_renf));
802798 return cone_ptr->nf ;
803799}
804800#endif
805801
806- static PyObject* pack_cone (Cone< mpz_class >* C, const void * dummy = nullptr )
802+ static PyObject* pack_cone (Cone< mpz_class >* C, void * dummy = nullptr )
807803{
808804 return PyCapsule_New (reinterpret_cast < void * >(C), cone_name,
809805 &delete_cone_mpz);
810806}
811807
812- static PyObject* pack_cone (Cone< long long >* C, const void * dummy = nullptr )
808+ static PyObject* pack_cone (Cone< long long >* C, void * dummy = nullptr )
813809{
814810 return PyCapsule_New (reinterpret_cast < void * >(C), cone_name_long,
815811 &delete_cone_long);
816812}
817813
818814#ifdef ENFNORMALIZ
819- static PyObject* pack_cone (Cone< renf_elem_class >* C, const void * nf)
815+ static PyObject* pack_cone (Cone< renf_elem_class >* C, void * nf)
820816{
821817 NumberFieldCone* cone_ptr = new NumberFieldCone ();
822- cone_ptr->nf = reinterpret_cast < const renf_class* >(nf);
818+ cone_ptr->nf = reinterpret_cast < renf_class* >(nf);
823819 cone_ptr->cone = C;
824820 return PyCapsule_New (reinterpret_cast < void * >(cone_ptr), cone_name_renf,
825821 &delete_cone_renf);
@@ -1012,14 +1008,13 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
10121008 }
10131009
10141010
1011+ renf_class* renf;
10151012 // number_field_data contains 3 entries: poly, var, emb
10161013 // All are strings
10171014 string poly = PyUnicodeToString (PySequence_GetItem (number_field_data, 0 ));
10181015 string var = PyUnicodeToString (PySequence_GetItem (number_field_data, 1 ));
10191016 string emb = PyUnicodeToString (PySequence_GetItem (number_field_data, 2 ));
1020- // std::shared_ptr<const renf_class>* renf = new std::shared_ptr<const renf_class>;
1021- std::shared_ptr<const renf_class> renf = renf_class::make (poly, var, emb);
1022- const renf_class* my_renf = renf.get ();
1017+ renf = new renf_class (poly.c_str (), var.c_str (), emb.c_str ());
10231018
10241019 map< InputType, vector< vector< renf_elem_class > > > input;
10251020
@@ -1041,7 +1036,7 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
10411036 continue ;
10421037 vector< vector< renf_elem_class > > Mat;
10431038 try {
1044- prepare_nf_input (Mat, current_value, my_renf );
1039+ prepare_nf_input (Mat, current_value, renf );
10451040 }
10461041 catch (PyNormalizInputException& e) {
10471042 PyErr_SetString (PyNormaliz_cppError,
@@ -1055,9 +1050,9 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
10551050 }
10561051
10571052 Cone< renf_elem_class >* C = new Cone< renf_elem_class >(input);
1058- C->setRenf (my_renf );
1059-
1060- PyObject* return_container = pack_cone (C, my_renf );
1053+ C->setRenf (renf );
1054+
1055+ PyObject* return_container = pack_cone (C, renf );
10611056
10621057 return return_container;
10631058 FUNC_END
@@ -1325,7 +1320,7 @@ PyObject* _NmzModify(Cone<Integer>* cone, PyObject* args)
13251320}
13261321
13271322#ifdef ENFNORMALIZ
1328- PyObject* _NmzModify_Renf (Cone<renf_elem_class>* cone, const renf_class* nf, PyObject* args)
1323+ PyObject* _NmzModify_Renf (Cone<renf_elem_class>* cone, renf_class* nf, PyObject* args)
13291324{
13301325 string property = PyUnicodeToString ( PyTuple_GetItem (args, 1 ) );
13311326 PyObject* matrix_py = PyTuple_GetItem (args,2 );
@@ -1364,7 +1359,7 @@ PyObject* _NmzModify_Outer(PyObject* self, PyObject* args)
13641359#ifdef ENFNORMALIZ
13651360 else if (is_cone_renf (cone)) {
13661361 Cone< renf_elem_class >* cone_ptr = get_cone_renf (cone);
1367- const renf_class* nf = get_cone_renf_renf (cone);
1362+ renf_class* nf = get_cone_renf_renf (cone);
13681363 return _NmzModify_Renf (cone_ptr, nf, args);
13691364 }
13701365#endif
@@ -1596,7 +1591,7 @@ second is the projection third is the annihilator.
15961591
15971592template < typename Integer >
15981593static PyObject*
1599- _NmzResultImpl (Cone< Integer >* C, PyObject* prop_obj, const void * nf = nullptr )
1594+ _NmzResultImpl (Cone< Integer >* C, PyObject* prop_obj, void * nf = nullptr )
16001595{
16011596
16021597 string prop = PyUnicodeToString (prop_obj);
@@ -1845,7 +1840,7 @@ MatrixHandler = NULL;
18451840 Cone< renf_elem_class >* cone_ptr = get_cone_renf (cone);
18461841 result = _NmzResultImpl (
18471842 cone_ptr, prop,
1848- reinterpret_cast < const void * >(get_cone_renf_renf (cone)));
1843+ reinterpret_cast < void * >(get_cone_renf_renf (cone)));
18491844 }
18501845#endif
18511846
@@ -2425,9 +2420,9 @@ static PyObject* NmzGetRenfInfo(PyObject* self, PyObject* args)
24252420 );
24262421 return NULL ;
24272422 }
2428- const renf_class* renf = get_cone_renf_renf (cone_py);
2423+ renf_class* renf = get_cone_renf_renf (cone_py);
24292424 std::string minpoly_str;
2430- minpoly_str = fmpq_poly_get_str_pretty (renf->get_renf ()->nf ->pol , renf->gen_name () .c_str ());
2425+ minpoly_str = fmpq_poly_get_str_pretty (renf->get_renf ()->nf ->pol , renf->gen_name .c_str ());
24312426 std::string res1 = arb_get_str (renf->get_renf ()->emb , 64 , 0 );
24322427 // long prec = renf->get_renf()->prec;
24332428 return PyTuple_Pack (2 , StringToPyUnicode (minpoly_str), StringToPyUnicode (res1));
0 commit comments