gen_fun: add copy constructor
[barvinok.git] / barvinok / util.h
blob108bbbca24ded376a4f9787e8a9ee59b3e954d60
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_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,
49 unsigned NbMaxRays);
50 void Line_Length(Polyhedron *P, Value *len);
51 evalue* ParamLine_Length(Polyhedron *P, Polyhedron *C, unsigned MaxRays);
52 void Extended_Euclid(Value a, Value b, Value *x, Value *y, Value *g);
53 Matrix * unimodular_complete(Vector *row);
54 Bool isIdentity(Matrix *M);
55 void Param_Polyhedron_Print(FILE* DST, Param_Polyhedron *PP, char **param_names);
56 void Enumeration_Print(FILE *Dst, Enumeration *en, char **params);
57 void Enumeration_Free(Enumeration *en);
58 void Enumeration_mod2table(Enumeration *en, unsigned nparam);
59 size_t Enumeration_size(Enumeration *en);
60 void Free_ParamNames(char **params, int m);
61 int DomainIncludes(Polyhedron *Pol1, Polyhedron *Pol2);
62 #ifndef HAVE_DOMAINCONSTRAINTSIMPLIFY
63 int ConstraintSimplify(Value *old, Value *n, int len, Value* v);
64 Polyhedron *DomainConstraintSimplify(Polyhedron *P, unsigned MaxRays);
65 #endif
66 int line_minmax(Polyhedron *I, Value *min, Value *max);
67 void count_points_e (int pos, Polyhedron *P, int exist, int nparam,
68 Value *context, Value *res);
69 int DomainContains(Polyhedron *P, Value *list_args, int len,
70 unsigned MaxRays, int set);
71 Polyhedron* Polyhedron_Project(Polyhedron *P, int dim);
72 Polyhedron *DomainConcat(Polyhedron *head, Polyhedron *tail);
74 /* only defined if PolyLib has RankingConstraints */
75 evalue *barvinok_lexsmaller_ev(Polyhedron *P, Polyhedron *D, unsigned dim,
76 Polyhedron *C, unsigned MaxRays);
77 Enumeration *barvinok_lexsmaller(Polyhedron *P, Polyhedron *D, unsigned dim,
78 Polyhedron *C, unsigned MaxRays);
80 Matrix *align_matrix(Matrix *M, int nrows);
82 char **util_generate_names(int n, char *prefix);
83 void util_free_names(int n, char **names);
84 void Polyhedron_pprint(FILE *out, Polyhedron *P, int dim, int nparam,
85 char **iter_names, char **param_names);
87 Polyhedron *Cone_over_Polyhedron(Polyhedron *P);
89 const char *barvinok_version();
91 #if defined(__cplusplus)
93 #endif
95 #endif