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