polylib 5.22.8
example.c
Go to the documentation of this file.
1/*
2 main.c
3 This file along with Zpolyhedron.c, polyhedron.c, Lattice.c,
4 Matop.c SolveDio.c, matrix.c and vector.c does the following :
5
6 - Intersection of two Z-Domains.
7 - Difference of two Z-domains.
8 - Image of a Z-domain by a invertible,
9 affine rational function.
10*/
11
12#include <polylib/polylib.h>
13
14int main () {
15
16 Matrix *a, *b;
17 Polyhedron *P;
18 ZPolyhedron *Z1, *Z2, *Z3, *Z4;
19
20 a = Matrix_Read ();
21 b = Matrix_Read ();
22 P = Constraints2Polyhedron (b, 200);
23 Z1 = ZPolyhedron_Alloc (a, P);
24
25 Matrix_Free (a);
26 Matrix_Free (b);
27 Domain_Free (P);
28
29 a = Matrix_Read ();
30 b = Matrix_Read ();
31 P = Constraints2Polyhedron (b, 200);
32 Z2 = ZPolyhedron_Alloc (a, P);
33
34 Matrix_Free (a);
35 Matrix_Free (b);
36 Domain_Free (P);
37
38 Z3 = ZDomainIntersection (Z1, Z2);
39 printf ("\nZ3 = Z1 and Z2");
40 ZDomainPrint(stdout,P_VALUE_FMT, Z3);
41
42 a = Matrix_Read ();
43 Z4 = ZDomainImage (Z1, a);
44 printf ("\nZ4 = image (Z1 by a)");
45 ZDomainPrint (stdout,P_VALUE_FMT, Z4);
46
47 Matrix_Free (a);
48 ZDomain_Free (Z1);
49 ZDomain_Free (Z2);
50 ZDomain_Free (Z3);
51 ZDomain_Free (Z4);
52
53 return 0;
54} /* main */
ZPolyhedron * ZDomainIntersection(ZPolyhedron *A, ZPolyhedron *B)
Definition: Zpolyhedron.c:375
void ZDomain_Free(ZPolyhedron *Head)
Definition: Zpolyhedron.c:75
void ZDomainPrint(FILE *fp, const char *format, ZPolyhedron *A)
Definition: Zpolyhedron.c:319
ZPolyhedron * ZPolyhedron_Alloc(Lattice *Lat, Polyhedron *Poly)
Definition: Zpolyhedron.c:37
ZPolyhedron * ZDomainImage(ZPolyhedron *A, Matrix *Func)
Definition: Zpolyhedron.c:466
int main()
Definition: example.c:14
Matrix * Matrix_Read(void)
Definition: matrix.c:209
void Matrix_Free(Matrix *Mat)
Definition: matrix.c:71
Polyhedron * Constraints2Polyhedron(Matrix *Constraints, unsigned NbMaxRays)
Given a matrix of constraints ('Constraints'), construct and return a polyhedron.
Definition: polyhedron.c:1905
void Domain_Free(Polyhedron *Pol)
Definition: polyhedron.c:1626
Definition: types.h:75
#define P_VALUE_FMT
Definition: types.h:39