polylib: example.c Source File

- Main Page
- Classes
- Files

# example.c

Go to the documentation of this file.

    00001
    00002 /*
    00003   main.c
    00004     This file along with Zpolyhedron.c, polyhedron.c, Lattice.c,
    00005     Matop.c SolveDio.c, matrix.c and vector.c does the following :
    00006
    00007      - Intersection of two Z-Domains.
    00008      - Difference of two Z-domains.
    00009      - Image of a Z-domain by a invertible,
    00010         affine rational function.
    00011 */
    00012
    00013 #include <polylib/polylib.h>
    00014
    00015 int main () {
    00016
    00017   Matrix *a, *b;
    00018   Polyhedron *P;
    00019   ZPolyhedron *Z1, *Z2, *Z3, *Z4;
    00020
    00021   a = Matrix_Read ();
    00022   b = Matrix_Read ();
    00023   P = Constraints2Polyhedron (b, 200);
    00024   Z1 = ZPolyhedron_Alloc (a, P);
    00025
    00026   Matrix_Free (a);
    00027   Matrix_Free (b);
    00028   Domain_Free (P);
    00029
    00030   a = Matrix_Read ();
    00031   b = Matrix_Read ();
    00032   P = Constraints2Polyhedron (b, 200);
    00033   Z2 = ZPolyhedron_Alloc (a, P);
    00034
    00035   Matrix_Free (a);
    00036   Matrix_Free (b);
    00037   Domain_Free (P);
    00038
    00039   Z3 = ZDomainIntersection (Z1, Z2);
    00040   printf ("\nZ3 = Z1 and Z2");
    00041   ZDomainPrint(stdout,P_VALUE_FMT, Z3);
    00042
    00043   a = Matrix_Read ();
    00044   Z4 = ZDomainImage (Z1, a);
    00045   printf ("\nZ4 = image (Z1 by a)");
    00046   ZDomainPrint (stdout,P_VALUE_FMT, Z4);
    00047
    00048   Matrix_Free (a);
    00049   ZDomain_Free (Z1);
    00050   ZDomain_Free (Z2);
    00051   ZDomain_Free (Z3);
    00052   ZDomain_Free (Z4);
    00053
    00054   return 0;
    00055 } /* main */