source: git/Singular/dyn_modules/python/wrapper.h @ 080559

fieker-DuValspielwiese
Last change on this file since 080559 was 080559, checked in by Hans Schoenemann <hannes@…>, 7 years ago
dyn_modules:python: first version
  • Property mode set to 100644
File size: 2.2 KB
Line 
1#ifndef PYTHON_SINGULAR_WRAPPER_HEADER
2#define PYTHON_SINGULAR_WRAPPER_HEADER
3#include <Python.h>
4#include <boost/python.hpp>
5#include <sstream>
6#include <kernel/mod2.h>
7
8
9#include "structs.h"
10#include "coeffs/numbers.h"
11
12//#include "febase.h"
13#include "ipid.h"
14#include "ipshell.h"
15//#include "util.h"
16#include "Number.h"
17#include "Poly.h"
18#include "PowerSeries.h"
19#include "Ideal.h"
20#include "ideal_wrap.h"
21#include <factory/factory.h>
22#include "poly_wrap.h"
23#include "vector_wrap.h"
24#include "CF_wrap.h"
25#include "number_wrap.h"
26//#include "playground.h"
27#include "interpreter_support.h"
28#include "ring_wrap.h"
29#include "intvec_wrap.h"
30using boost::python::numeric::array;
31using boost::python::extract;
32
33using namespace boost::python;
34
35Vector unitVector0(int i){
36  return unitVector(i,currRing);
37}
38
39
40
41
42
43
44
45//typedef void * idhdl;
46void different_ring_translator(DifferentDomainException const& x) {
47    PrintS("hoho");
48    PyErr_SetString(PyExc_UserWarning, "Objects didn't have the same ring");
49}
50BOOST_PYTHON_MODULE(Singular){
51  //Print("ref count after add: %d", currRing->ref);
52  register_exception_translator<
53          DifferentDomainException>(different_ring_translator);
54  export_poly();
55
56
57
58  export_number();
59  export_vector();
60  //export_playground();
61  export_ideal();
62  export_module();
63  //export_interpreter();
64  export_ring();
65  export_intvec();
66  boost::python::class_<PowerSeries>("power_series")
67    .def(boost::python::init <const PowerSeries::numerator_type &,const PowerSeries::denominator_type&>())
68    .def("__iter__", boost::python::iterator<PowerSeries>());
69  boost::python::class_<VectorPowerSeries>("vector_power_series")
70    .def(boost::python::init <const VectorPowerSeries::numerator_type&,const VectorPowerSeries::denominator_type &>())
71    .def("__iter__", boost::python::iterator<VectorPowerSeries>());
72  def("gen",unitVector0);
73
74
75  //    .def(self+=self)
76
77  //   .def(self+self)
78  //.def(self*=Number())
79  //.def(Number() * self);
80
81}
82BOOST_PYTHON_MODULE(factory){
83  boost::python::class_<Variable>("variable")
84    .def(boost::python::init <const int, char>())
85    .def(boost::python::init <char>())
86
87    .def(boost::python::init <const int>());
88  export_CF();
89}
90BOOST_PYTHON_MODULE(_Singular){
91export_interpreter();
92
93}
94#endif
Note: See TracBrowser for help on using the repository browser.