My Project
Toggle main menu visibility
Loading...
Searching...
No Matches
Singular
dyn_modules
python
ideal_wrap.cc
Go to the documentation of this file.
1
#include "
kernel/mod2.h
"
2
#ifdef HAVE_PYTHON
3
#include <boost/python.hpp>
4
#include "
Poly.h
"
5
#include "
Ideal.h
"
6
#include "
ring_wrap.h
"
7
8
#include "
poly_wrap.h
"
9
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
10
using
boost::python::self;
11
using namespace
boost::python;
12
13
static
boost::python::object
Ideal_as_str
(
const
Ideal
&
p
)
14
{
15
using
boost::python::str;
16
//ring r=p.getRing();
17
str helper;
18
list tojoin;
19
int
i
;
20
int
s
=
p
.size();
21
//tojoin.append("[");
22
for
(
i
=0;
i
<
s
;
i
++){
23
tojoin.append(
Poly_as_str
(
p
[
i
]));
24
if
(
i
<
s
-1)
25
tojoin.append(
", "
);
26
}
27
//tojoin.append("]");
28
str
res
=helper.join(tojoin);
29
return
res
;
30
}
31
static
boost::python::object
Module_as_str
(
const
Module
&
p
)
32
{
33
using
boost::python::str;
34
//ring r=p.getRing();
35
str helper;
36
list tojoin;
37
int
i
;
38
int
s
=
p
.size();
39
//tojoin.append("[");
40
for
(
i
=0;
i
<
s
;
i
++){
41
tojoin.append(
Vector_as_str
(
p
[
i
]));
42
if
(
i
<
s
-1)
43
tojoin.append(
", "
);
44
}
45
//tojoin.append("]");
46
str
res
=helper.join(tojoin);
47
return
res
;
48
}
49
50
static
Ring
Ideal_get_Ring
(
const
Ideal
&
p
){
51
return
p
.getRing();
52
}
53
54
55
void
export_ideal
()
56
{
57
boost::python::class_<Ideal>(
"Ideal"
,
"supports most operation a\
58
python list supports with the expception, that elements must\
59
be Polynomials"
)
60
.def(init<>())
61
.def(init<const Ideal&>())
62
.def(
"__str__"
,
Ideal_as_str
)
63
.def(
"ring"
,
Ideal_get_Ring
)
64
.def(boost::python::init <>())
65
.def(vector_indexing_suite<Ideal >());
66
67
}
68
void
export_module
()
69
{
70
boost::python::class_<Module>(
"Module"
,
"supports most operation a\
71
python list supports with the expception, that elements must\
72
be Polynomials"
)
73
.def(init<>())
74
.def(init<const Module&>())
75
.def(
"__str__"
,
Module_as_str
)
76
.def(
"ring"
,
Ideal_get_Ring
)
77
.def(boost::python::init <>())
78
.def(vector_indexing_suite<Module>());
79
80
}
81
#endif
Ideal.h
Poly.h
i
int i
Definition
cfEzgcd.cc:132
p
int p
Definition
cfModGcd.cc:4086
Ideal
Definition
Ideal.h:88
Module
Definition
Ideal.h:121
Ring
Definition
ring_wrap.h:21
s
const CanonicalForm int s
Definition
facAbsFact.cc:51
res
CanonicalForm res
Definition
facAbsFact.cc:60
export_module
void export_module()
Definition
ideal_wrap.cc:68
Ideal_get_Ring
static Ring Ideal_get_Ring(const Ideal &p)
Definition
ideal_wrap.cc:50
export_ideal
void export_ideal()
Definition
ideal_wrap.cc:55
Ideal_as_str
static boost::python::object Ideal_as_str(const Ideal &p)
Definition
ideal_wrap.cc:13
Module_as_str
static boost::python::object Module_as_str(const Module &p)
Definition
ideal_wrap.cc:31
mod2.h
Poly_as_str
boost::python::str Poly_as_str(const Poly &p)
Definition
poly_wrap.cc:10
Vector_as_str
boost::python::str Vector_as_str(const Vector &p)
Definition
poly_wrap.cc:18
poly_wrap.h
ring_wrap.h
Generated on
for My Project by
doxygen 1.17.0
for
Singular