1 #ifndef BERNSTEIN_PIECWISE_LST_H
2 #define BERNSTEIN_PIECWISE_LST_H
7 #include <ginac/ginac.h>
9 #include <polylib/polylibgmp.h>
14 typedef std::pair
< Polyhedron
*, GiNaC::lst
> guarded_lst
;
16 struct piecewise_lst
{
17 const GiNaC::exvector vars
;
18 std::vector
<guarded_lst
> list
;
19 /* 0: just collect terms
20 * 1: remove obviously smaller terms (maximize)
21 * -1: remove obviously bigger terms (minimize)
25 piecewise_lst(const GiNaC::exvector
& vars
, int sign
= 0) :
26 vars(vars
), sign(sign
) {}
27 void add_guarded_lst(Polyhedron
*D
, GiNaC::lst coeffs
);
28 piecewise_lst
& combine(const piecewise_lst
& other
);
31 void simplify_domains(Polyhedron
*ctx
, unsigned MaxRays
);
32 GiNaC::numeric
evaluate(const GiNaC::exvector
& values
);
33 void evaluate(int n
, Value
*v
, Value
*n
, Value
*d
);
34 GiNaC::numeric
evaluate(const GiNaC::exvector
& values
, int n
, Value
*v
);
35 void add(const GiNaC::ex
& poly
);
36 int is_equal(const piecewise_lst
& other
) const;
42 /* We don't allow making copies (yet), because we would have
43 * to make copies of all polyhedra.
45 piecewise_lst(const piecewise_lst
&) {}
46 void free_list_domains() {
47 for (int i
= 0; i
< list
.size(); ++i
)
48 Domain_Free(list
[i
].first
);
52 std::ostream
& operator<< (std::ostream
& os
, const piecewise_lst
& pl
);