polylib: example.c Source File

- Main Page
- Classes
- Files

- File List
- File Members

# 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     This file is part of PolyLib.
    00014
    00015     PolyLib is free software: you can redistribute it and/or modify
    00016     it under the terms of the GNU General Public License as published by
    00017     the Free Software Foundation, either version 3 of the License, or
    00018     (at your option) any later version.
    00019
    00020     PolyLib is distributed in the hope that it will be useful,
    00021     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00022     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00023     GNU General Public License for more details.
    00024
    00025     You should have received a copy of the GNU General Public License
    00026     along with PolyLib.  If not, see <http://www.gnu.org/licenses/>.
    00027 */
    00028
    00029
    00030 #include <polylib/polylib.h>
    00031
    00032 int main () {
    00033
    00034   Matrix *a, *b;
    00035   Polyhedron *P;
    00036   ZPolyhedron *Z1, *Z2, *Z3, *Z4;
    00037
    00038   a = Matrix_Read ();
    00039   b = Matrix_Read ();
    00040   P = Constraints2Polyhedron (b, 200);
    00041   Z1 = ZPolyhedron_Alloc (a, P);
    00042
    00043   Matrix_Free (a);
    00044   Matrix_Free (b);
    00045   Domain_Free (P);
    00046
    00047   a = Matrix_Read ();
    00048   b = Matrix_Read ();
    00049   P = Constraints2Polyhedron (b, 200);
    00050   Z2 = ZPolyhedron_Alloc (a, P);
    00051
    00052   Matrix_Free (a);
    00053   Matrix_Free (b);
    00054   Domain_Free (P);
    00055
    00056   Z3 = ZDomainIntersection (Z1, Z2);
    00057   printf ("\nZ3 = Z1 and Z2");
    00058   ZDomainPrint(stdout,P_VALUE_FMT, Z3);
    00059
    00060   a = Matrix_Read ();
    00061   Z4 = ZDomainImage (Z1, a);
    00062   printf ("\nZ4 = image (Z1 by a)");
    00063   ZDomainPrint (stdout,P_VALUE_FMT, Z4);
    00064
    00065   Matrix_Free (a);
    00066   ZDomain_Free (Z1);
    00067   ZDomain_Free (Z2);
    00068   ZDomain_Free (Z3);
    00069   ZDomain_Free (Z4);
    00070
    00071   return 0;
    00072 } /* main */