fixed a small bug in eval ehrhart
[polylib.git] / applications / example.c
blobc260fb7db8d9d91b9f83362c2ba83203709af515
2 /*
3 main.c
4 This file along with Zpolyhedron.c, polyhedron.c, Lattice.c,
5 Matop.c SolveDio.c, matrix.c and vector.c does the following :
7 - Intersection of two Z-Domains.
8 - Difference of two Z-domains.
9 - Image of a Z-domain by a invertible,
10 affine rational function.
13 #include <polylib/polylib.h>
15 int main () {
17 Matrix *a, *b;
18 Polyhedron *P;
19 ZPolyhedron *Z1, *Z2, *Z3, *Z4;
21 a = Matrix_Read ();
22 b = Matrix_Read ();
23 P = Constraints2Polyhedron (b, 200);
24 Z1 = ZPolyhedron_Alloc (a, P);
26 Matrix_Free (a);
27 Matrix_Free (b);
28 Domain_Free (P);
30 a = Matrix_Read ();
31 b = Matrix_Read ();
32 P = Constraints2Polyhedron (b, 200);
33 Z2 = ZPolyhedron_Alloc (a, P);
35 Matrix_Free (a);
36 Matrix_Free (b);
37 Domain_Free (P);
39 Z3 = ZDomainIntersection (Z1, Z2);
40 printf ("\nZ3 = Z1 and Z2");
41 ZDomainPrint(stdout,P_VALUE_FMT, Z3);
43 a = Matrix_Read ();
44 Z4 = ZDomainImage (Z1, a);
45 printf ("\nZ4 = image (Z1 by a)");
46 ZDomainPrint (stdout,P_VALUE_FMT, Z4);
48 Matrix_Free (a);
49 ZDomain_Free (Z1);
50 ZDomain_Free (Z2);
51 ZDomain_Free (Z3);
52 ZDomain_Free (Z4);
54 return 0;
55 } /* main */