@@ -18,11 +18,6 @@ using std::string;
18
18
19
19
#include < libnormaliz/libnormaliz.h>
20
20
21
- #ifdef ENFNORMALIZ
22
- using eantic::renf_elem_class;
23
- using eantic::renf_class;
24
- #endif
25
-
26
21
using libnormaliz::Cone;
27
22
// using libnormaliz::ConeProperty;
28
23
using libnormaliz::ConeProperties;
@@ -473,10 +468,11 @@ static bool prepare_nf_input(vector< vector< NumberFieldElem > >& out,
473
468
if (!current_res) {
474
469
return false ;
475
470
}
476
- current_elem = renf_elem_class (nf-> shared_from_this (), current_vector);
471
+ current_elem = NumberFieldElem (*nf, current_vector);
477
472
}
478
473
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);
480
476
}
481
477
if (PyFloat_Check (current_element)){
482
478
throw PyNormalizInputException (" Nonintegral numbers must be given as strings" );
@@ -746,7 +742,7 @@ NmzAutomorphismsToPython(const AutomorphismGroup< Integer >& grp)
746
742
747
743
#ifdef ENFNORMALIZ
748
744
struct NumberFieldCone {
749
- const renf_class* nf;
745
+ renf_class* nf;
750
746
Cone< renf_elem_class >* cone;
751
747
};
752
748
#endif
@@ -795,31 +791,31 @@ static Cone< renf_elem_class >* get_cone_renf(PyObject* cone)
795
791
return cone_ptr->cone ;
796
792
}
797
793
798
- static const renf_class* get_cone_renf_renf (PyObject* cone)
794
+ static renf_class* get_cone_renf_renf (PyObject* cone)
799
795
{
800
796
NumberFieldCone* cone_ptr = reinterpret_cast < NumberFieldCone* >(
801
797
PyCapsule_GetPointer (cone, cone_name_renf));
802
798
return cone_ptr->nf ;
803
799
}
804
800
#endif
805
801
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 )
807
803
{
808
804
return PyCapsule_New (reinterpret_cast < void * >(C), cone_name,
809
805
&delete_cone_mpz);
810
806
}
811
807
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 )
813
809
{
814
810
return PyCapsule_New (reinterpret_cast < void * >(C), cone_name_long,
815
811
&delete_cone_long);
816
812
}
817
813
818
814
#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)
820
816
{
821
817
NumberFieldCone* cone_ptr = new NumberFieldCone ();
822
- cone_ptr->nf = reinterpret_cast < const renf_class* >(nf);
818
+ cone_ptr->nf = reinterpret_cast < renf_class* >(nf);
823
819
cone_ptr->cone = C;
824
820
return PyCapsule_New (reinterpret_cast < void * >(cone_ptr), cone_name_renf,
825
821
&delete_cone_renf);
@@ -1012,14 +1008,13 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
1012
1008
}
1013
1009
1014
1010
1011
+ renf_class* renf;
1015
1012
// number_field_data contains 3 entries: poly, var, emb
1016
1013
// All are strings
1017
1014
string poly = PyUnicodeToString (PySequence_GetItem (number_field_data, 0 ));
1018
1015
string var = PyUnicodeToString (PySequence_GetItem (number_field_data, 1 ));
1019
1016
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 ());
1023
1018
1024
1019
map< InputType, vector< vector< renf_elem_class > > > input;
1025
1020
@@ -1041,7 +1036,7 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
1041
1036
continue ;
1042
1037
vector< vector< renf_elem_class > > Mat;
1043
1038
try {
1044
- prepare_nf_input (Mat, current_value, my_renf );
1039
+ prepare_nf_input (Mat, current_value, renf );
1045
1040
}
1046
1041
catch (PyNormalizInputException& e) {
1047
1042
PyErr_SetString (PyNormaliz_cppError,
@@ -1055,9 +1050,9 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
1055
1050
}
1056
1051
1057
1052
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 );
1061
1056
1062
1057
return return_container;
1063
1058
FUNC_END
@@ -1325,7 +1320,7 @@ PyObject* _NmzModify(Cone<Integer>* cone, PyObject* args)
1325
1320
}
1326
1321
1327
1322
#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)
1329
1324
{
1330
1325
string property = PyUnicodeToString ( PyTuple_GetItem (args, 1 ) );
1331
1326
PyObject* matrix_py = PyTuple_GetItem (args,2 );
@@ -1364,7 +1359,7 @@ PyObject* _NmzModify_Outer(PyObject* self, PyObject* args)
1364
1359
#ifdef ENFNORMALIZ
1365
1360
else if (is_cone_renf (cone)) {
1366
1361
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);
1368
1363
return _NmzModify_Renf (cone_ptr, nf, args);
1369
1364
}
1370
1365
#endif
@@ -1596,7 +1591,7 @@ second is the projection third is the annihilator.
1596
1591
1597
1592
template < typename Integer >
1598
1593
static PyObject*
1599
- _NmzResultImpl (Cone< Integer >* C, PyObject* prop_obj, const void * nf = nullptr )
1594
+ _NmzResultImpl (Cone< Integer >* C, PyObject* prop_obj, void * nf = nullptr )
1600
1595
{
1601
1596
1602
1597
string prop = PyUnicodeToString (prop_obj);
@@ -1845,7 +1840,7 @@ MatrixHandler = NULL;
1845
1840
Cone< renf_elem_class >* cone_ptr = get_cone_renf (cone);
1846
1841
result = _NmzResultImpl (
1847
1842
cone_ptr, prop,
1848
- reinterpret_cast < const void * >(get_cone_renf_renf (cone)));
1843
+ reinterpret_cast < void * >(get_cone_renf_renf (cone)));
1849
1844
}
1850
1845
#endif
1851
1846
@@ -2425,9 +2420,9 @@ static PyObject* NmzGetRenfInfo(PyObject* self, PyObject* args)
2425
2420
);
2426
2421
return NULL ;
2427
2422
}
2428
- const renf_class* renf = get_cone_renf_renf (cone_py);
2423
+ renf_class* renf = get_cone_renf_renf (cone_py);
2429
2424
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 ());
2431
2426
std::string res1 = arb_get_str (renf->get_renf ()->emb , 64 , 0 );
2432
2427
// long prec = renf->get_renf()->prec;
2433
2428
return PyTuple_Pack (2 , StringToPyUnicode (minpoly_str), StringToPyUnicode (res1));
0 commit comments