wrapper.h
Go to the documentation of this file.
1 #ifndef PYTHON_SINGULAR_WRAPPER_HEADER
2 #define PYTHON_SINGULAR_WRAPPER_HEADER
3 #include <Python.h>
4 #include <boost/python.hpp>
5 #include <boost/python/numpy.hpp>
6 #include <sstream>
7 #include <kernel/mod2.h>
8 
9 
10 #include "kernel/structs.h"
11 #include "coeffs/numbers.h"
12 
13 #include "Singular/ipid.h"
14 #include "Singular/ipshell.h"
15 #include "Number.h"
16 #include "Poly.h"
17 #include "PowerSeries.h"
18 #include "Ideal.h"
19 #include "ideal_wrap.h"
20 #include <factory/factory.h>
21 #include "poly_wrap.h"
22 #include "vector_wrap.h"
23 #include "CF_wrap.h"
24 #include "number_wrap.h"
25 #include "interpreter_support.h"
26 #include "ring_wrap.h"
27 #include "intvec_wrap.h"
28 using boost::python::numpy::ndarray;
29 using boost::python::extract;
30 
31 using namespace boost::python;
32 
34 {
35  return unitVector(i,currRing);
36 }
37 
39 {
40  PrintS("hoho");
41  PyErr_SetString(PyExc_UserWarning, "Objects didn't have the same ring");
42 }
44 {
45  //Print("ref count after add: %d", currRing->ref);
46  register_exception_translator<
48  export_poly();
49  export_number();
50  export_vector();
51  //export_playground();
52  export_ideal();
53  export_module();
54  //export_interpreter();
55  export_ring();
56  export_intvec();
57  boost::python::class_<PowerSeries>("power_series")
58  .def(boost::python::init <const PowerSeries::numerator_type &,const PowerSeries::denominator_type&>())
59  .def("__iter__", boost::python::iterator<PowerSeries>());
60  boost::python::class_<VectorPowerSeries>("vector_power_series")
61  .def(boost::python::init <const VectorPowerSeries::numerator_type&,const VectorPowerSeries::denominator_type &>())
62  .def("__iter__", boost::python::iterator<VectorPowerSeries>());
63  def("gen",unitVector0);
64  // .def(self+=self)
65  // .def(self+self)
66  //.def(self*=Number())
67  //.def(Number() * self);
68 }
70 {
71  boost::python::class_<Variable>("variable")
72  .def(boost::python::init <const int, char>())
73  .def(boost::python::init <char>())
74  .def(boost::python::init <const int>());
75  export_CF();
76 }
78 {
80 }
81 #endif
void export_ideal()
Vector unitVector(int i, ring r=currRing)
Definition: Poly.h:630
Definition: Poly.h:509
Vector unitVector0(int i)
Definition: wrapper.h:33
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void export_CF()
void export_interpreter()
void export_number()
void export_ring()
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
void export_poly()
void different_ring_translator(DifferentDomainException const &x)
Definition: wrapper.h:38
BOOST_PYTHON_MODULE(Singular)
Definition: wrapper.h:43
void export_intvec()
void export_module()
Variable x
Definition: cfModGcd.cc:4023
void export_vector()