bernstein_coefficients: optionally optimize during recursive computation
[barvinok.git] / barvinok / util.h
blob3e0833de75c17563644b28cf9a5636ab1f5bbe64
1 #ifndef UTIL_H
2 #define UTIL_H
4 #include <barvinok/polylib.h>
6 #if defined(__cplusplus)
7 extern "C" {
8 #endif
10 #include <barvinok/evalue.h>
12 #ifdef POL_NO_DUAL
13 #define emptyQ2(P) \
14 ((F_ISSET(P, POL_INEQUALITIES) && P->NbEq > P->Dimension) || \
15 (F_ISSET(P, POL_POINTS) && P->NbRays == 0))
16 #define POL_HAS(P,f) (F_ISSET(P, f))
17 #define POL_SET(P,f) (F_SET(P, f))
18 #else
19 #define POL_NO_DUAL 0
20 #define emptyQ2(P) emptyQ(P)
21 #define POL_ENSURE_FACETS(P) /* nothing */
22 #define POL_ENSURE_VERTICES(P) /* nothing */
23 #define POL_INEQUALITIES 0
24 #define POL_POINTS 0
25 #define POL_FACETS 0
26 #define POL_VERTICES 0
27 #define POL_VALID 0
28 #define POL_HAS(P,f) (1)
29 #define POL_SET(P,f) /* nothing */
30 #endif
32 #ifndef POL_INTEGER
33 #define POL_INTEGER 0
34 #endif
36 void value_lcm(const Value i, const Value j, Value* lcm);
37 int random_int(int max);
38 Polyhedron *Polyhedron_Read(unsigned MaxRays);
39 Polyhedron* Polyhedron_Polar(Polyhedron *P, unsigned NbMaxRays);
40 void Polyhedron_Polarize(Polyhedron *P);
41 Polyhedron* supporting_cone(Polyhedron *P, int v);
42 Polyhedron* supporting_cone_p(Polyhedron *P, Param_Vertices *v);
43 Polyhedron* triangulate_cone(Polyhedron *P, unsigned NbMaxCons);
44 void check_triangulization(Polyhedron *P, Polyhedron *T);
45 Polyhedron *remove_equalities(Polyhedron *P);
46 Polyhedron *remove_equalities_p(Polyhedron *P, unsigned nvar, Matrix **factor);
47 void manual_count(Polyhedron *P, Value* result);
48 Polyhedron* Polyhedron_Factor(Polyhedron *P, unsigned nparam, Matrix **T,
49 unsigned NbMaxRays);
50 void Line_Length(Polyhedron *P, Value *len);
51 struct barvinok_options;
52 evalue* ParamLine_Length(Polyhedron *P, Polyhedron *C,
53 struct barvinok_options *options);
54 void Extended_Euclid(Value a, Value b, Value *x, Value *y, Value *g);
55 Matrix * unimodular_complete(Vector *row);
56 Bool isIdentity(Matrix *M);
57 void Param_Polyhedron_Print(FILE* DST, Param_Polyhedron *PP, char **param_names);
58 void Enumeration_Print(FILE *Dst, Enumeration *en, char **params);
59 void Enumeration_Free(Enumeration *en);
60 void Enumeration_mod2table(Enumeration *en, unsigned nparam);
61 size_t Enumeration_size(Enumeration *en);
62 void Free_ParamNames(char **params, int m);
63 int DomainIncludes(Polyhedron *Pol1, Polyhedron *Pol2);
64 #ifndef HAVE_DOMAINCONSTRAINTSIMPLIFY
65 int ConstraintSimplify(Value *old, Value *n, int len, Value* v);
66 Polyhedron *DomainConstraintSimplify(Polyhedron *P, unsigned MaxRays);
67 #endif
68 int line_minmax(Polyhedron *I, Value *min, Value *max);
69 void count_points_e (int pos, Polyhedron *P, int exist, int nparam,
70 Value *context, Value *res);
71 int DomainContains(Polyhedron *P, Value *list_args, int len,
72 unsigned MaxRays, int set);
73 Polyhedron* Polyhedron_Project(Polyhedron *P, int dim);
74 Polyhedron *DomainConcat(Polyhedron *head, Polyhedron *tail);
76 /* only defined if PolyLib has RankingConstraints */
77 evalue *barvinok_lexsmaller_ev(Polyhedron *P, Polyhedron *D, unsigned dim,
78 Polyhedron *C, unsigned MaxRays);
79 Enumeration *barvinok_lexsmaller(Polyhedron *P, Polyhedron *D, unsigned dim,
80 Polyhedron *C, unsigned MaxRays);
82 Matrix *align_matrix(Matrix *M, int nrows);
84 char **util_generate_names(int n, char *prefix);
85 void util_free_names(int n, char **names);
86 void Polyhedron_pprint(FILE *out, Polyhedron *P, int dim, int nparam,
87 char **iter_names, char **param_names);
89 Polyhedron *Cone_over_Polyhedron(Polyhedron *P);
91 Matrix *compress_variables(Matrix *Equalities, unsigned nparam);
92 Matrix *left_inverse(Matrix *M, Matrix **Eq);
94 int Polyhedron_has_revlex_positive_rays(Polyhedron *P, unsigned nparam);
95 int Polyhedron_is_unbounded(Polyhedron *P, unsigned nparam, unsigned MaxRays);
97 const char *barvinok_version();
99 #if defined(__cplusplus)
101 #endif
103 #endif