Polyhedron_Sample: allow equalities in input polyhedra
[barvinok.git] / remove_redundant_equalities.c
blob4556fd9f8b34a00bfeb22121eb9b80bfbaa37a9c
1 #include <polylib/polylibgmp.h>
2 #include <barvinok/evalue.h>
3 #include <barvinok/util.h>
4 #include "config.h"
6 #ifdef HAVE_GROWING_CHERNIKOVA
7 #define MAXRAYS 0
8 #else
9 #define MAXRAYS 600
10 #endif
12 void dump_polytope(Polyhedron *P)
14 int i, j;
15 unsigned nr, nc;
17 fprintf(stdout, "%d %d\n", nr=P->NbConstraints, nc=P->Dimension+2);
18 for (i=0; i < nr; i++) {
19 for (j=0; j < nc; j++) {
20 value_print(stdout," "P_VALUE_FMT" ", P->Constraint[i][j]);
22 fprintf(stdout, "\n");
26 int main(int argc, char **argv)
28 Polyhedron *A, *C;
29 Matrix *M;
30 Enumeration *en;
31 char **param_name;
32 int i;
34 M = Matrix_Read();
35 A = Constraints2Polyhedron(M, MAXRAYS);
36 Matrix_Free(M);
37 M = Matrix_Read();
38 C = Constraints2Polyhedron(M, MAXRAYS);
39 Matrix_Free(M);
40 param_name = Read_ParamNames(stdin, C->Dimension);
41 A = remove_equalities_p(A, A->Dimension-C->Dimension, 0);
42 dump_polytope(A);
43 puts("");
44 dump_polytope(C);
45 puts("");
46 for (i = 0; i < C->Dimension; ++i)
47 printf("%s ", param_name[i]);
48 puts("");
49 Free_ParamNames(param_name, C->Dimension);
50 Polyhedron_Free(A);
51 Polyhedron_Free(C);
52 return 0;