@@ -18,6 +18,9 @@ using std::string;
1818
1919#include < libnormaliz/libnormaliz.h>
2020
21+ using eantic::renf_elem_class;
22+ using eantic::renf_class;
23+
2124using libnormaliz::Cone;
2225// using libnormaliz::ConeProperty;
2326using libnormaliz::ConeProperties;
@@ -468,11 +471,10 @@ static bool prepare_nf_input(vector< vector< NumberFieldElem > >& out,
468471 if (!current_res) {
469472 return false ;
470473 }
471- current_elem = NumberFieldElem (*nf, current_vector);
474+ current_elem = renf_elem_class (nf-> shared_from_this (), current_vector);
472475 }
473476 if (string_check (current_element)) {
474- current_elem = NumberFieldElem (*nf);
475- current_elem = PyUnicodeToString (current_element);
477+ current_elem =renf_elem_class (nf->shared_from_this (),PyUnicodeToString (current_element));
476478 }
477479 if (PyFloat_Check (current_element)){
478480 throw PyNormalizInputException (" Nonintegral numbers must be given as strings" );
@@ -1008,13 +1010,14 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
10081010 }
10091011
10101012
1011- renf_class* renf;
10121013 // number_field_data contains 3 entries: poly, var, emb
10131014 // All are strings
10141015 string poly = PyUnicodeToString (PySequence_GetItem (number_field_data, 0 ));
10151016 string var = PyUnicodeToString (PySequence_GetItem (number_field_data, 1 ));
10161017 string emb = PyUnicodeToString (PySequence_GetItem (number_field_data, 2 ));
1017- renf = new renf_class (poly.c_str (), var.c_str (), emb.c_str ());
1018+ std::shared_ptr<const renf_class>* renf = new std::shared_ptr<const renf_class>;
1019+ *renf = renf_class::make (poly, var, emb);
1020+ const renf_class* my_renf = renf->get ();
10181021
10191022 map< InputType, vector< vector< renf_elem_class > > > input;
10201023
@@ -1036,7 +1039,7 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
10361039 continue ;
10371040 vector< vector< renf_elem_class > > Mat;
10381041 try {
1039- prepare_nf_input (Mat, current_value, renf );
1042+ prepare_nf_input (Mat, current_value, my_renf );
10401043 }
10411044 catch (PyNormalizInputException& e) {
10421045 PyErr_SetString (PyNormaliz_cppError,
@@ -1050,7 +1053,7 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
10501053 }
10511054
10521055 Cone< renf_elem_class >* C = new Cone< renf_elem_class >(input);
1053- C->setRenf (renf );
1056+ C->setRenf (my_renf );
10541057
10551058 PyObject* return_container = pack_cone (C, renf);
10561059
@@ -2422,7 +2425,7 @@ static PyObject* NmzGetRenfInfo(PyObject* self, PyObject* args)
24222425 }
24232426 renf_class* renf = get_cone_renf_renf (cone_py);
24242427 std::string minpoly_str;
2425- minpoly_str = fmpq_poly_get_str_pretty (renf->get_renf ()->nf ->pol , renf->gen_name .c_str ());
2428+ minpoly_str = fmpq_poly_get_str_pretty (renf->get_renf ()->nf ->pol , renf->gen_name () .c_str ());
24262429 std::string res1 = arb_get_str (renf->get_renf ()->emb , 64 , 0 );
24272430 // long prec = renf->get_renf()->prec;
24282431 return PyTuple_Pack (2 , StringToPyUnicode (minpoly_str), StringToPyUnicode (res1));
0 commit comments