1libppl_c(3) libppl_c overview libppl_c(3)
2
3
4
6 libppl_c - the C interface of the Parma Polyhedra Library
7
9 #include <ppl_c.h>
10
11 cc file.c -lppl
12
13
15 This is a short overview on how to use the Parma Polyhedra Library
16 (PPL) in your C programs on Unix-like operating systems. Note that the
17 PPL has interfaces also for C++, Java, OCaml and a number of Prolog
18 systems: look elsewhere for documentation on those. Note also that the
19 present document does not describe the library functionality, its
20 classes or its methods and functions: see The Parma Polyhedra Library
21 User's Manual (version 0.10.2) and The Parma Polyhedra Library C Lan‐
22 guage Interface User's Manual (version 0.10.2) for this kind of infor‐
23 mation.
24
25
27 The C interface of the PPL has only one header file, named ppl_c.h. So
28 your program should contain a directive of the form
29
30 #include <ppl_c.h>
31
32 Of course, you must make sure you installed the PPL in a place where
33 the compiler can find it, either by itself or with the help of a suit‐
34 able -Idir command line option (see the file INSTALL for information on
35 how to configure the library so that it is installed in the place of
36 your choice).
37
38
40 In order to initialize the Parma Polyhedra Library you must call the
41 function
42
43 int ppl_initialize(void)
44
45 before using any of its functionalities. It is also a good norm to
46 call the function
47
48 int ppl_finalize(void)
49
50 when you are done with the library.
51
52
54 Keeping in mind that there is no substitute for a careful reading of
55 The Parma Polyhedra Library User's Manual (version 0.10.2) and The
56 Parma Polyhedra Library C Language Interface User's Manual (version
57 0.10.2) you can find examples of use in the directories inter‐
58 faces/C/tests and demos/ppl_lpsol of the source distribution.
59
60
62 Linking with the C interface of the Parma Polyhedra Library is best
63 done using the C compiler itself: usually, specifying the -lppl_c com‐
64 mand line option is enough. In fact, if you use a shared version of
65 the library, this automatically records the dependency from the PPL
66 core and the GMP libraries, something that the linker ought to deal
67 with gracefully. Otherwise you will have to add -lppl -lgmpxx -lgmp to
68 the command line. Things are more complex if you installed the PPL
69 into some nonstandard place. In this case you will have to use the
70 -Ldir option and, if you use a shared version of the library, possible
71 take further steps: see the documentation of your system for more
72 information on this subject (the Program Library HOWTO is especially
73 valuable for GNU/Linux users).
74
75
77 All the PPL C interface functions return an int: a negative value means
78 that an error occurred. See The Parma Polyhedra Library C Language
79 Interface User's Manual (version 0.10.2) for the error codes.
80
81
83 One of the interesting features of the Parma Polyhedra Library is the
84 possibility to implement memory-guarded computations. The idea is that
85 you can limit the amount of virtual memory available to the process,
86 launch a PPL computation, and be ready to be returned a
87 PPL_ERROR_OUT_OF_MEMORY error code. You can then take the appropriate
88 corrective measures (e.g., simplify the polyhedra and/or select less
89 precise though less complex algorithms), and restart the computation.
90 In order to do that, you should define alternative memory allocation
91 functions for GMP that throw std::bad_alloc upon memory exhaustion.
92 See libppl(3) for instructions on how to do that.
93
94
96 At initialization time, the Parma Polyhedra Library sets the FPU round‐
97 ing mode in a way that allows its floating-point-based computations to
98 be conservative (i.e., possibly approximated but correct) and reason‐
99 ably efficient. In case your application itself uses native floating
100 point numbers and relies on a particular rounding mode (if you are in
101 doubt, assume that it does rely on round-to-nearest to be in effect),
102 you should use the function
103
104 int ppl_restore_pre_PPL_rounding()
105
106 after the PPL initialization and before using native floating point
107 numbers in the application. If your application does not use any
108 floating-point-based PPL abstraction, no further measure should be
109 taken. Otherwise, it is imperative to call the function
110
111 int ppl_set_rounding_for_PPL()
112
113 before invoking any PPL interface related to such abstractions.
114
115
116
118 ppl-config(1)
119
120 libppl(3)
121
122 Roberto Bagnara, Patricia M. Hill, and Enea Zaffanella. The Parma
123 Polyhedra Library User's Manual (version 0.10.2), available (in several
124 formats) at http://www.cs.unipr.it/ppl/ .
125
126 Roberto Bagnara, Patricia M. Hill, and Enea Zaffanella. The Parma
127 Polyhedra Library C Language Interface User's Manual (version 0.10.2),
128 available (in several formats) at http://www.cs.unipr.it/ppl/ .
129
130 David A. Wheeler. Program Library HOWTO, available (in several for‐
131 mats) at http://www.dwheeler.com/program-library/ .
132
133
135 The latest version of the Parma Polyhedra Library and all the documen‐
136 tation is available at http://www.cs.unipr.it/ppl/ .
137
138
140 See the file CREDITS in the source distribution or use the command
141 ppl-config --credits for a list of contributors.
142
143
145 Report bugs to <ppl-devel@cs.unipr.it>.
146
147
149 Copyright (C) 2001-2009 Roberto Bagnara <bagnara@cs.unipr.it>
150 This is free software; see the file COPYING in the source distribution
151 or use the command ppl-config --copying to obtain the copying condi‐
152 tions. There is NO warranty; not even for MERCHANTABILITY or FITNESS
153 FOR A PARTICULAR PURPOSE.
154
155
156
157PPL 0.10.2 April 2009 libppl_c(3)