polylib 7.01
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 LBL *Z1, *Z2, *Z3, *Z4;
19
20 a = Matrix_Read ();
21 b = Matrix_Read ();
22 P = Constraints2Polyhedron (b, 200);
23 Z1 = LBLAlloc (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 = LBLAlloc (a, P);
33
34 Matrix_Free (a);
35 Matrix_Free (b);
36 Domain_Free (P);
37
38 Z3 = LBLIntersection (Z1, Z2);
39 printf ("\nZ3 = Z1 and Z2");
40 LBLPrint(stdout,P_VALUE_FMT, Z3);
41
42 a = Matrix_Read ();
43 Z4 = LBLImage (Z1, a);
44 printf ("\nZ4 = image (Z1 by a)");
45 LBLPrint (stdout,P_VALUE_FMT, Z4);
46
47 Matrix_Free (a);
48 LBLFree (Z1);
49 LBLFree (Z2);
50 LBLFree (Z3);
51 LBLFree (Z4);
52
53 return 0;
54} /* main */
LBL * LBLImage(LBL *A, Matrix *Func)
Definition: Zpolyhedron.c:475
void LBLFree(LBL *L)
Definition: Zpolyhedron.c:122
void LBLPrint(FILE *fp, const char *format, LBL *A)
Definition: Zpolyhedron.c:324
LBL * LBLIntersection(LBL *A, LBL *B)
Definition: Zpolyhedron.c:364
LBL * LBLAlloc(Matrix *Lat, Polyhedron *Domain)
Definition: Zpolyhedron.c:75
int main()
Definition: example.c:14
Matrix * Matrix_Read(void)
Definition: matrix.c:218
void Matrix_Free(Matrix *Mat)
Definition: matrix.c:69
Polyhedron * Constraints2Polyhedron(Matrix *Constraints, unsigned NbMaxRays)
Given a matrix of constraints ('Constraints'), construct and return a polyhedron.
Definition: polyhedron.c:1912
void Domain_Free(Polyhedron *Pol)
Definition: polyhedron.c:1633
Definition: types.h:245
Definition: types.h:88
#define P_VALUE_FMT
Definition: types.h:42