Loading...
Searching...
No Matches
playground.cc
Go to the documentation of this file.
#include "kernel/mod2.h"
#ifdef HAVE_PYTHON
#include <boost/python.hpp>
#include "Poly.h"
#include "boost/python/numeric.hpp"
using boost::python::numeric::array;
using boost::python::self;
using boost::python::make_tuple;
using boost::python::tuple;
using boost::python::object;
using boost::python::list;
object foo()
{
list l;
for(int j=0;j<2;j++)
{
list row;
for(int i=0;i<10;i++)
{
Poly ip(i*(j+1),currRing);
row.append(ip);
//a[boost::python::make_tuple(i%2,i%5)]=ip;
//a[boost::python::make_tuple(i%2,i%5)]=ip;
}
l.append(row);
}
boost::python::numeric::array::set_module_and_type("Numeric",
"ArrayType"
);
boost::python::numeric::array a(l);
return a;
}
object foo2(array f)
{
using boost::python::extract;
object o=f.attr("shape");
object o1=o[0];
object o2=o[1];
int l1=extract<int>(o1);
Print("%d",l1);
int l2=extract<int>(o2);
Print("%d",l2);
Poly& x = boost::python::extract<Poly&>(f[boost::python::make_tuple(0,0)]);
x.print();
return boost::python::str("suc");
}
void export_playground()
{
def("foo",foo);
def("foo2",foo2);
}
#endif
Poly.h
l
int l
Definition cfEzgcd.cc:100
i
int i
Definition cfEzgcd.cc:132
x
Variable x
Definition cfModGcd.cc:4090
f
FILE * f
Definition checklibs.c:9
Print
#define Print
Definition emacs.cc:80
j
int j
Definition facHensel.cc:110
mod2.h
export_playground
void export_playground()
Definition playground.cc:51
foo
object foo()
Definition playground.cc:12
foo2
object foo2(array f)
Definition playground.cc:33
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
Poly
Definition janet.h:15