volume.c: introduce parameter_point abstraction
[barvinok.git] / barvinok / util.h
blob4d6294fa9ebbed5b36214e57574187d7eb90ec02
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))
19 #define POL_UNSET(flags,f) do { \
20 if (POL_ISSET(flags, POL_HIGH_BIT)) \
21 flags = (flags & ~(f)) | POL_HIGH_BIT; \
22 } while(0)
23 #else
24 #define POL_NO_DUAL 0
25 #define emptyQ2(P) emptyQ(P)
26 #define POL_ENSURE_FACETS(P) /* nothing */
27 #define POL_ENSURE_VERTICES(P) /* nothing */
28 #define POL_INEQUALITIES 0
29 #define POL_POINTS 0
30 #define POL_FACETS 0
31 #define POL_VERTICES 0
32 #define POL_VALID 0
33 #define POL_HAS(P,f) (1)
34 #define POL_SET(P,f) /* nothing */
36 #define POL_UNSET(P,f) /* nothing */
37 #endif
39 #ifndef POL_INTEGER
40 #define POL_INTEGER 0
41 #endif
43 struct barvinok_options;
45 void value_lcm(const Value i, const Value j, Value* lcm);
46 int random_int(int max);
47 Polyhedron *Polyhedron_Read(unsigned MaxRays);
48 Polyhedron* Polyhedron_Polar(Polyhedron *P, unsigned NbMaxRays);
49 void Polyhedron_Polarize(Polyhedron *P);
50 Polyhedron* supporting_cone(Polyhedron *P, int v);
51 unsigned char *supporting_constraints(Polyhedron *P, Param_Vertices *v, int *n);
52 Polyhedron* supporting_cone_p(Polyhedron *P, Param_Vertices *v);
53 Polyhedron* triangulate_cone(Polyhedron *P, unsigned NbMaxCons);
54 Polyhedron* triangulate_cone_with_options(Polyhedron *P,
55 struct barvinok_options *options);
56 void check_triangulization(Polyhedron *P, Polyhedron *T);
57 Polyhedron *remove_equalities(Polyhedron *P);
58 Polyhedron *remove_equalities_p(Polyhedron *P, unsigned nvar, Matrix **factor);
59 void manual_count(Polyhedron *P, Value* result);
60 Polyhedron* Polyhedron_Factor(Polyhedron *P, unsigned nparam, Matrix **T,
61 unsigned NbMaxRays);
62 void Line_Length(Polyhedron *P, Value *len);
63 struct barvinok_options;
64 evalue* ParamLine_Length(Polyhedron *P, Polyhedron *C,
65 struct barvinok_options *options);
66 void Extended_Euclid(Value a, Value b, Value *x, Value *y, Value *g);
67 Matrix * unimodular_complete(Vector *row);
68 Bool isIdentity(Matrix *M);
69 void Param_Polyhedron_Print(FILE* DST, Param_Polyhedron *PP, char **param_names);
70 void Enumeration_Print(FILE *Dst, Enumeration *en, char **params);
71 void Enumeration_Free(Enumeration *en);
72 void Enumeration_mod2table(Enumeration *en, unsigned nparam);
73 size_t Enumeration_size(Enumeration *en);
74 void Free_ParamNames(char **params, int m);
75 int DomainIncludes(Polyhedron *Pol1, Polyhedron *Pol2);
76 #ifndef HAVE_DOMAINCONSTRAINTSIMPLIFY
77 int ConstraintSimplify(Value *old, Value *n, int len, Value* v);
78 Polyhedron *DomainConstraintSimplify(Polyhedron *P, unsigned MaxRays);
79 #endif
80 int line_minmax(Polyhedron *I, Value *min, Value *max);
81 void count_points_e (int pos, Polyhedron *P, int exist, int nparam,
82 Value *context, Value *res);
83 int DomainContains(Polyhedron *P, Value *list_args, int len,
84 unsigned MaxRays, int set);
85 Polyhedron* Polyhedron_Project(Polyhedron *P, int dim);
86 Polyhedron *DomainConcat(Polyhedron *head, Polyhedron *tail);
88 /* only defined if PolyLib has RankingConstraints */
89 evalue *barvinok_lexsmaller_ev(Polyhedron *P, Polyhedron *D, unsigned dim,
90 Polyhedron *C, unsigned MaxRays);
91 Enumeration *barvinok_lexsmaller(Polyhedron *P, Polyhedron *D, unsigned dim,
92 Polyhedron *C, unsigned MaxRays);
94 Matrix *align_matrix(Matrix *M, int nrows);
96 char **util_generate_names(int n, char *prefix);
97 void util_free_names(int n, char **names);
98 void Polyhedron_pprint(FILE *out, Polyhedron *P, int dim, int nparam,
99 char **iter_names, char **param_names);
101 Polyhedron *Cone_over_Polyhedron(Polyhedron *P);
103 Matrix *compress_variables(Matrix *Equalities, unsigned nparam);
104 Matrix *left_inverse(Matrix *M, Matrix **Eq);
106 int Polyhedron_has_revlex_positive_rays(Polyhedron *P, unsigned nparam);
107 int Polyhedron_is_unbounded(Polyhedron *P, unsigned nparam, unsigned MaxRays);
109 const char *barvinok_version();
111 #if defined(__cplusplus)
113 #endif
115 #endif