Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/libs/ppl_shim.cc
4058 views
1
#include "ppl_shim.hh"
2
3
4
5
6
// /************************************************************/
7
Generator* new_line(const Linear_Expression& e)
8
{
9
return new Generator(Generator::line(e));
10
}
11
12
Generator* new_ray(const Linear_Expression& e)
13
{
14
return new Generator(Generator::ray(e));
15
}
16
17
Generator* new_point(const Linear_Expression& e, Coefficient d)
18
{
19
return new Generator(Generator::point(e, d));
20
}
21
22
Generator* new_closure_point(const Linear_Expression& e, Coefficient d)
23
{
24
return new Generator(Generator::closure_point(e, d));
25
}
26
27
28
/************************************************************/
29
Poly_Gen_Relation* new_relation_with(const Polyhedron &p, const Generator &g)
30
{
31
return new Poly_Gen_Relation(p.relation_with(g));
32
}
33
34
Poly_Con_Relation* new_relation_with(const Polyhedron &p, const Constraint &c)
35
{
36
return new Poly_Con_Relation(p.relation_with(c));
37
}
38
39
40
/************************************************************/
41
typedef Generator_System::const_iterator* gs_iterator_ptr;
42
43
gs_iterator_ptr init_gs_iterator(const Generator_System &gs)
44
{
45
return new Generator_System::const_iterator(gs.begin());
46
}
47
48
Generator next_gs_iterator(gs_iterator_ptr gsi_ptr)
49
{
50
return *(*gsi_ptr)++;
51
}
52
53
bool is_end_gs_iterator(const Generator_System &gs, gs_iterator_ptr gsi_ptr)
54
{
55
return (*gsi_ptr) == gs.end();
56
}
57
58
void delete_gs_iterator(gs_iterator_ptr gsi_ptr)
59
{
60
delete gsi_ptr;
61
}
62
63
64
/************************************************************/
65
typedef Constraint_System::const_iterator* cs_iterator_ptr;
66
67
cs_iterator_ptr init_cs_iterator(const Constraint_System &cs)
68
{
69
return new Constraint_System::const_iterator(cs.begin());
70
}
71
72
Constraint next_cs_iterator(cs_iterator_ptr csi_ptr)
73
{
74
return *(*csi_ptr)++;
75
}
76
77
bool is_end_cs_iterator(const Constraint_System &cs, cs_iterator_ptr csi_ptr)
78
{
79
return (*csi_ptr) == cs.end();
80
}
81
82
void delete_cs_iterator(cs_iterator_ptr csi_ptr)
83
{
84
delete csi_ptr;
85
}
86
87
88