4#include <boost/python.hpp>
5#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
22using namespace boost::python;
23using boost::python::extract;
30#if BOOST_VERSION < 106500
33#include <boost/python/numpy.hpp>
39 object o=
f.attr(
"shape");
42 int l1=extract<int>(o1);
43 int l2=extract<int>(o2);
49 Poly&
x = boost::python::extract<Poly&>(
f[boost::python::make_tuple(
i,
j)]);
107 v->data=
p.as_ideal();
114 v->data=
p.as_module();
121 v->data=(
void*)((
long)
p);
128 v->data=(
void*)
p.as_number();
180 v->data=
l.dumpToLists();
243 id->data.p=
p.as_poly();
251 id->data.uideal=
p.as_ideal();
259 id->data.uideal=
p.as_module();
274 id->data.n=
p.as_number();
282 id->data.p=
p.as_poly();
299 ((ring)
id->
data.uring)->ref--;
300 ring r2=r.
pimpl.get();
326 id->data.l=
f.dumpToLists();
335 using boost::python::self;
336 using boost::python::make_tuple;
337 using boost::python::tuple;
338 using boost::python::object;
339 using boost::python::list;
354 #if BOOST_VERSION <106500
356 NumpyArrayType::set_module_and_type(
"Numeric",
361 return boost::python::numpy::array(
l);
367 using boost::python::list;
370 for(
int i=0;
i<=
l->nr;
i++)
381 using boost::python::object;
385 return object((
int)((
long)
v->data));
389 return str((
const char*)
v->data);
403 return object(
Ring((ring)
v->data));
413 using boost::python::object;
418 return str((
const char*)
id.id->data.ustring);
421 return object((
int)
id.id->data.i);
446 return object(
Ring((ring)
id.id->data.uring));
517 using boost::python::str;
520 std::basic_stringstream<char>
s;
522 return boost::python::str(
s.str());
532 boost::python::class_<arg_list>(
"i_arg_list")
544 boost::python::class_<idhdl_wrap>(
"interpreter_id")
unsigned char * proc[NUM_PROC]
intvec * allocate_legacy_intvec_copy() const
intrusive_ptr< ip_sring > pimpl
void internal_append(leftv v)
void appendArray(const NumpyArrayType &f)
void appendPrelist(arg_list &l)
void appendNumber(const Number &p)
void appendVector(const Vector &p)
void appendString(const char *s)
void appendIntvec(Intvec &iv)
void appendModule(const Module &p)
void appendPoly(const Poly &p)
void appendIdeal(const Ideal &p)
void appendRing(const Ring &r)
void writeIdeal(const Ideal &p)
void writeList(arg_list &f)
void writePoly(const Poly &p)
void writeString(const char *s)
void writeNumber(const Number &p)
void writeIntvec(const Intvec &iv)
void writeVector(const Vector &p)
void writeArray(const NumpyArrayType &f)
void writeRing(const Ring &r)
void writeModule(const Module &p)
Class used for (list of) interpreter objects.
void CleanUp(ring r=currRing)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
bool is_builtin(const char *name)
static NumpyArrayType buildPythonMatrix(matrix m, ring r)
boost::python::object call_builtin_method_general(const char *name, arg_list &l)
matrix matrixFromArray(const NumpyArrayType &f)
void export_interpreter()
static boost::python::str idhdl_as_str(idhdl_wrap iw)
static idhdl_wrap get_idhdl(const char *n)
static void free_leftv(leftv args)
boost::python::list buildPythonList(lists l, ring r)
boost::python::object call_interpreter_method(const idhdl_wrap &proc, const arg_list &args)
boost::python::object buildPyObjectFromLeftv(leftv v)
boost::python::numeric::array NumpyArrayType
boost::python::object buildPyObjectFromIdhdl(const idhdl_wrap &id)
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
int IsCmd(const char *n, int &tok)
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
idhdl ggetid(const char *n)
EXTERN_VAR omBin sleftv_bin
BOOLEAN iiMake_proc(idhdl pn, package pack, leftv args)
INST_VAR sleftv iiRETURNEXPR
matrix mpNew(int r, int c)
create a r x c zero-matrix
#define MATELEM(mat, i, j)
1-based access to matrix
#define omFreeBin(addr, bin)
static void p_Delete(poly *p, const ring r)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int name
New type name for int.