4 - added a polylib_free() function to free all cached memory
5 (valgrind and multithread safe polylib)
8 ******************************************************************************
10 The new polylib library combines both the Strasbourg version and IRISA version
11 and includes option to support 32 bit or 64 bit or GNU muti-precision integers.
12 It also includes the recent (April 2001) changes suggested by Doran Wilde and
13 the changes made by Vincent Loechner in polylib4.20. A new feature: computati-
14 ons on Z-polyhedron has been added into the new polylib version.
15 The new version has following changes compared to the polylib version at
18 *******************************************************************************
20 Directory: ./include/polylib
24 * Included "GMP" value-type.
25 eg: #else /* If defined(GNUMP) */
26 #define LINEAR_VALUE_GMP "gmp"
29 * Added macros corresponding to "GMP" value-type :-
30 eg:- ! Basic Macros :- value_init(val), etc..
31 ! Boolean operators on 'Value' :- value_eq(v1,v2), etc...
32 ! Trian operators on 'Value' :- value_sign(val),etc..
33 ! Binary operations on 'Value' :- value_addto(ref,val)
34 ! Conditional operations on 'Value' :- value_pos_p(val), etc...
36 * A few macros are not defined for "GMP" value-types compared to other
37 defined value-types, as there is no way to do so in "GMP".
38 eg:- (i) VALUE_CONST, VALUE_NAN, VALUE_MAX, VALUE_MIN, etc...
39 (ii) ! Cast to value macros :- int_to_value(i), etc....
40 (iii)! Binary operators on 'Value' :- value_plus(v1,v2), etc..
41 (iV) ! Unary operators on 'Value' :- value_not(val), etc...
43 * A few macros not defined for "GMP" value-types compared to other
44 defined value-types, as they seemed redundant in "GMP".
45 eg:- (i) value_direct_product(ref,val) /* No overflow check reqd. */
46 (ii) ! Various macros for protected multiplication :-
47 value_protected_multiply(v,w)
49 * A new set of macro defintions included in every value-type to handle
50 initialization and clear operations in "GMP".
51 eg:- value_init(val), value_assign(v1,v2),value_clear(val), etc ..
53 * A few macro definitions changed.
54 eg:- value_addto(ref,val) -> value_addto(ref,val1,val2)
55 value_increment(ref) -> value_increment(ref,val). etc...
57 * A few function prototype definitions removed as they were redundant.
58 eg:- extern Value abs_ofl_ctrl(...): abs.c
59 extern Value divide_fast(....): divide.c
60 extern Value pgcd_slow(......): pgcd.c
62 * Comments added and modified wherever seemed appropriate.
64 (2) arithmetic_errors.h
66 * added a test on the cygwin flag for CATCH and THROW macros
70 * Changes in function prototype definitions to match with the changes
71 made in the file 'eval_ehrhart.c'.
75 * Changes in function prototype definitions to match with the changes
76 made in the file 'matrix.c'.
81 extern Polyhedron *Stras_DomainSimplify(Polyhedron *Pol1, Polyhedron
82 *Pol2, unsigned NbMaxRays);
84 * Changes in function prototype definitions to match with the changes
85 made in the file 'polyhedron.c'.
89 * Added statement: && !defined(GNUMP)
91 * Removed few statements.
92 eg:- #include <polylib/types_mp.h>
93 #include <polylib/matrix_mp.h>
94 #include <polylib/ehrhart_mp.h>
98 * Changes in function prototype definitions to match with the changes
99 made in the file 'polyparam.c'.
103 * Added macro: #ifdef DGNUMP
107 $define MAXNOOFRAYS 200
109 * Added statement: #else /* Default : GNUMP */
110 #define P_VALUE_FMT "%4s"
113 * Added Data-structures to represent Z-Polyhedron
114 eg: Lattice, LatticeUnion, ZPolyhedron
116 * Deleted a few redundant macros:
121 * Deleted file "types_mp.h", as it is not required now.
123 * Comments added and modified wherever seemed appropriate.
127 * Changes in function prototype definitions to match with the changes
128 made in the file 'vector.c'.
130 (10) Addition of new header files
131 eg: Solvedio.h, Lattice.h, Matop.h, NormalForms.h and Zpolyhedron.h
135 * Changes in Makefile to match with the changes made in the library.
137 *******************************************************************************
139 Directory: ./ArithLib
141 (1) arithmetic_errors.h (copied from ./include/polylib/arithmetic_errors.h)
143 (2) arithmetique.h (copied from ./include/polylib/arithmetique.h)
145 (3) Deleted redundant files "arithmetique-local.h", "abs.c", "divide.c",
146 "doc.h", "exp.c", "io.c", "linear.h" "modulo.c", "pgcd.c", "pgcm.c".
148 *******************************************************************************
154 * Changes in local variable names in function declarations
156 (1) main : Value k -> int k
161 * Programming code changed from K&R C to ANSI C.
163 * Changes in parameter names or return type in function declarations
165 (1) Scan_Vertices : returned type changed to (Value*) from
168 * Changes in local variable names in function declarations
170 (1) cherche_min : j (added)
171 (2) Polyhedron_Preprocess : tmp, size_copy (added)
172 (3) Polyhedron_Preprocess2 : tmp1, tmp2 (added)
173 (4) old_Polyhedron_Preprocess : temp (deleted)
174 abs_a, abs_b, size_copy (added)
175 (5) count_points : result (added)
176 (5) P_Enum : temp (deleted)
177 tmp, lcm_copy (added)
178 (6) Enumerate_NoParametres : j, tmp (added)
179 (7) Polyhedron_Enumerate : i (added)
180 (8) main : i,str (added)
182 * Comments added wherever seemed appropriate.
184 * Changes in almost all the functions in order to make it generic and
185 allow handling of all the 'Value' types including GMP.
187 * Deleted file "ehrhart_mp.c" as it is not required now.
191 * Changes in parameter names or return type in function declarations
193 (1) compute_poly : return type changed to (Value *) from Value
195 * Changes in local variable names in function declarations
197 (1) in_domain : tmp (added)
198 (2) compute_poly : tmp (added)
200 * Changes in almost all the functions in order to make it generic and
201 allow handling of all the 'Value' types including GMP.
205 * Added file "example.c" in ./source directory.
207 * A few macro definitions removed:
208 eg: #include "types.h"
210 #include "vector.h", etc....
212 * A few macro definitions added:
213 eg: #include "polylib/polylib.h"
217 * Added file "Lattice.c" in ./source directory.
219 * Removed macro header definitions
220 eg: #include "types.h"
221 #include "ztypes.h" etc..
223 * Added macro header definitions
224 eg: #include <polylib/polylib.h>
226 * Changes in parameter names or return type in function declarations
229 * Changes in local variable names in function declarations
232 (1) AffineSmith : sum, quo, rem (added)
233 (2) LatticeDifference : int k -> Value k
234 (3) AddLattice : tmp (added)
235 (4) FindHermiteBasisofDomain : fact(added)
237 (5) LatticePreimage : tmp (added)
238 int divisor -> Value divisor
239 (6) Simplify : aux,k,fac, num, tmp, foobar (added)
241 (7) AffinePartSimplify : aux (added)
243 * Comments added wherever seemed appropriate.
245 * Changes in almost all the functions in order to make it generic and
246 allow handling of all the 'Value' types including GMP.
250 * Added file "Matop.c" in ./source directory.
252 * Removed macro header definitions
253 eg: #include "types.h"
254 #include "ztypes.h" etc..
256 * Added macro header definitions
257 eg: #include <polylib/polylib.h>
259 * Changes in parameter names or return type in function declarations
261 (1) Lcm : return type changed to (Value *) from (int)
265 * Changes in local variable names in function declarations
267 (1) Lcm : tmp, aux (added)
268 (2) ExchangeRows : int *temp -> Value *temp
269 (3) ExchangeColumns : int *temp -> Value *temp;
270 (4) isIntegral : int divisor -> Value divisor
272 (5) isinHnf : int rem -> Value rem
273 (6) PutRowLast : int *vector -> Value *vector
274 (7) PutRowFirst : int *vector -> Value *vector
275 (8) PutColumnFirst : int *vector -> Value *vector
276 (9) PutColumnLast : int *vector -> Value *vector
278 * Comments added wherever seemed appropriate.
280 * Changes in almost all the functions in order to make it generic and
281 allow handling of all the 'Value' types including GMP.
286 * Programming code changed from K&R C to ANSI C.
288 * A few functions added:
289 eg: int Matrix_Inverse(Matrix *Mat, Matrix *MatInv)
291 * Changes in parameter names or return type in function declarations
293 (1) MatInverse : M -> Mat
295 (2) Matrix_Vector_Product : mat -> Mat
296 (3) Vector_Matrix_Product : mat -> Mat
297 (4) Matrix_Product : mat1 -> Mat1
301 * Changes in local variable names in function declarations
303 (1) Matrix_Alloc : j (added)
304 (2) Matrix_Free : (i,j,p) (added)
305 (3) Matrix_Read_Input : str (added)
306 (4) hermite : aux (added)
309 (5) MatInverse : g -> gcd
311 li -> j, tmp (deleted)
312 (6) rat_prodmat : denom -> last column_index
316 d -> last_column_entry
317 s -> s1, s2(added), tmp (deleted)
318 (7) Matrix_Vector_Product : s (added)
319 (8) Vector_Matrix_Product : s (added)
320 (9) Matrix_Product : s (added)
322 * Error correction in code
325 if (value_zero_p(dcom)) -> if (value_one_p(dcom))
327 * Deleted file "matrix_mp.c", as it is not required now.
329 * Comments added wherever seemed appropriate.
331 * Changes in almost all the functions in order to make it generic and
332 allow handling of all the 'Value' types including GMP.
336 * Added file "NormalForms.c" in ./source directory.
338 * Programming code changed from K&R C to ANSI C.
340 * Removed macro header definitions
341 eg: #include "types.h"
342 #include "ztypes.h" etc..
344 * Added macro header definitions
345 eg: #include <polylib/polylib.h>
347 * Removed function: static int abs(int x)
349 * Changes in parameter names or return type in function declarations
351 (1) moins_l : int *a -> Value *a
352 (2) moins_c : int *a -> Value *a
353 (3) echange_l : int *a -> Value *a
354 (4) echange_c : int *a -> Value *a
355 (5) ligne : int *a -> Value *a
357 (6) colonne : int *a -> Value *a
359 (7) petit_l : int *a -> Value *a
360 (8) petit_c : int *a -> Value *a
361 (9) identite : int *a -> Value *a
362 (10) transpose: int *a -> Value *a
363 (11) encore : int *a -> Value *a
365 (12) smith : int *a -> Value *a
368 int *b_inverse -> Value *b_inverse
369 int *c_inverse -> Value *c_inverse
370 (13) hermite : int *a, -> Value *a
373 (14) ConvertpolMattoDarMat : return type changed to (Value *)
375 (15) ConvertDarMattoPolMat : int *A -> Value *A
378 * Changes in local variable names in function declarations
380 (1) moins_l : int *c -> Value *c
381 (2) moins_c : int *c -> Value *c
382 (3) echange_l : int s -> Value s
383 int *c1, *c2 -> Value *c1, *c2
384 (4) echange_c : int s -> Value s
385 int *c1, *c2 -> Value *c1, *c2
386 (5) ligne : int *c1, *c2 :-> Value *c1, *c2
388 (6) colonne : int *c1, *c2 -> Value *c1, *c2
390 (7) petit_l : int *c -> Value *c
391 int minus, comp -> Value minus, comp
392 (8) petit_c : int *c -> Value *c
393 int minus, comp -> Value minus, comp
394 (9) identite : int *b -> Value *b
395 (10) transpose : int *b, *c -> Value *b, *c
397 (11) encore : int *c -> Value *c
398 int comp -> Vale comp
400 (12) smith : int *f -> Value *f
401 int x, pivot -> Value x, pivot
403 (13) hermite : int *c1 -> Value *c1
404 int x, pivot -> Value x, pivot
406 (14) ConvertPolMattoDarMat : int *result -> Value *result
407 (15) Smith : int *a, *u, *v, *u_inv, *v_inv ->
408 Value *a, *u, *v, *u_inv, *v_inv
410 (16) Hermite : int *darte_matA -> Value *darte_matA
411 int *darte_identite -> Value *darte_identite
412 int *darte_id_inv -> Value *darte_id_inv
415 * Comments added wherever seemed appropriate.
417 * Changes in almost all the functions in order to make it generic and
418 allow handling of all the 'Value' types including GMP.
422 * Programming code changed from K&R C to ANSI C.
424 * A few function declarations removed.
425 eg: VVPd,IVPd,MPd (functions)
427 * A few function names changed.
429 SatVector_Or -> SatVector_OR
432 * A few functions added
434 (1) Stras_DomainSimplify(Pol1, Pol2, NbMaxRays)
435 (2) SimplifyEqualities(Pol1, Pol2, Filter)
437 * Changes in Macro definition
438 eg: bexchange(a,b,t,l) -> bexchange(a,b,l)
440 * Changes in parameter names in function declarations
442 (1) Combine : temp (deleted)
443 (2) RaySort : Temp1 (deleted), Temp2 (deleted)
444 (3) Gauss : temp (deleted)
445 (4) Rays2Polyhedron : NbMaxRays -> NbMaxConstrs
446 (5) BuildSat : NbCon -> NbConstraints
447 (6) AddConstraints : Con2 -> Con
448 NbCon2 -> NbConstraints
450 (7) AddPolyToDomain : p3 -> Pol
452 (8) SubConstraint : Con2 -> Con
454 (9) AddRays : Ray2 ->AddedRays
455 NbRay2 -> NbAddedRays
457 NbMaxRays -> NbMaxConstrs
458 (10) DomainAddRays : Pol1 -> Pol
460 NbMaxRays -> NbMaxConstrs
461 (11) DomainConvex : Pol1 -> Pol
462 NbMaxRays -> NbMaxConstrs
463 (12) align_context : D -> Pol
466 (13) Polyhedron_Scan : MAXRAYS -> NbMaxRays
467 (14) Polyhedron_Preimage : Pol1 -> Pol
468 (15) DomainPreimage : Pol1 -> Pol
469 (16) Polyhedron_Image : Pol1 -> Pol
470 NbMaxrays -> NbMaxConstrs
471 (17) DomainImage : Pol1 -> Pol
472 NbMaxRays -> NbMaxConstrs
473 (18) DomainCost : Pol1 -> Pol
474 (19) DomainAddConstraints : Pol1 -> Pol
477 * Changes in local variable names in function declarations
479 (1) Combine : a -> gcd
480 abs_a1,abs_a2,neg_a1 (added)
481 (2) TransformSat : nc2 -> sat_nbcolumns
483 (3) Chernikova : nc -> sat_nbcolumns
486 (4) Gauss : col_of_rank -> column_index
489 (5) Remove_Redundants : nc -> sat_nbcolumns
491 tmp1,tmp2,tmp3 (added)
493 (6) Polyhedron_Alloc : j (added)
494 (7) Polyhedron_Free : size,p,NbRows,NbColumns (added)
495 (8) Domain_Free : size,p,NbRows,NbColumns (added)
496 (9) Constraints2Polyhedron : nc -> nbcolumns
497 (10) Rays2Polyhedron: Sat -> SatTranspose
500 (11) BuildSat : nc -> nbcolumns
502 (12) AddConstraints : Pol -> NewPol
503 NbCon1, NbEle1 (deleted)
504 (13) PolyhedronIncludes : tmp (added)
505 (14) AddPolyToDomain : p3end -> p_domain_end
506 (15) SubConstraint : Pol -> NewPol
509 (16) AddRays : Pol -> NewPol
514 (17) FindSimple : tmp (added)
515 (18) SimplifyConstraints : notvid ->notempty
516 (19) SimplifyEqualities : temp (deleted)
517 (20) DomainSimplify : nc -> nbentries
521 (21) DomainConvex : Pol -> NewPol
523 (22) align_context : p1 -> q
525 (23) Polyhedron_Scan : dim2 (deleted)
528 (24) lower_upper_bounds : tmp (added)
529 (25) Polyhedron_Preimage : Pol2 -> NewPol
531 (26) DomainPreimage : p1 -> q
532 (27) Polyhedron_Image : Pol2 -> NewPol
534 (28) DomainImage : p1 -> q
535 (29) DomainCost : tmp1,tmp2,tmp3 (added)
537 * Error correction in code
540 column_index = (int *)malloc(Dimension*sizeof(Value)) ->
541 column_index = (int *)malloc(Dimension*sizeof(int))
544 if (PolyhedronIncludes(p2,p1)) -> if (PolyhedronIncludes(p2,p3))
546 (3) DomainAddConstraints:
547 if (PolyhedronIncludes(p2,p1)) -> if (PolyhedronIncludes(p2,p3))
549 * Comments added wherever seemed appropriate.
551 * Changes in almost all the functions in order to make it generic and
552 allow handling of all the 'Value' types including GMP.
556 * Programming code changed from K&R C to ANSI C.
558 * A few macro definitions removed.
559 eg: Vector_Init (deleted)
561 * A few function declarations removed.
564 * Changes in parametres names in function declarations
566 (1) TestRank : M -> Mat
568 (2) SMaAlloc : m -> matrix
569 (3) Poly2Sat : P -> Pol
570 (4) GenParamPolyhedron : poly -> Pol
571 (5) Param_Domain_Free : PP -> PD
573 * Changes in local variable names in function declarations
575 (1) TestRank : gcd (added)
576 (2) Poly2Sat : Tmp -> Temp
578 (3) Elim_Columns : tmp1, tmp2 (added)
579 (4) Polyhedron2Param_Vertices : res -> result
580 (5) Param_Vertices_Free : n -> next_pv
581 (6) Print_Vertex : t (deleted), tmp (added)
583 (7) Param_Vertices_Print : a -> poly
584 (8) Polyhedron2Param_Domain : res -> result
585 (9) Polyhedron2Param_SimplifiedDomain : res ->result
586 (10) Param_Domain_Free : n -> next_pd
588 * Error correction in code:
590 (1) PDomainIntersection :
591 Uncommented statement - Polyhedron_Free(p3);
593 * Comments added wherever seemed appropriate.
595 * Changes in almost all the functions in order to make it generic and
596 allow handling of all the 'Value' types including GMP.
600 * Programming code changed from K&R C to ANSI C.
602 * Changes in Macro definition
603 eg: bexchange(a,b,t,l) (deleted)
605 * Changes in parameter names or return type in function declarations
607 (1) exist_points : P -> Pol
608 (2) PolyhedronLTQ : P1 -> Pol1
610 MAXRAYS -> NbMaxConstrs
611 (3) GaussSimplify : M -> Mat1
614 * Changes in local variable names or types in function declarations
616 (1) exist_points : tmp (added)
617 (2) Polyhedron_Not_Empty : i (added)
618 (3) PolyhedronLTQ : M -> Mat
619 (4) GaussSimplify : col_of_rank :-> column_index
621 temp,RowSize (deleted)
623 * Error correction in code:
626 if(value_gt(gcd,int_to_value(2))) -> if(value_ge(...))
628 * Comments added wherever seemed appropriate.
630 * Changes in almost all the functions in order to make it generic and
631 allow handling of all the 'Value' types including GMP.
635 * Added file "SolveDio.c" in ./source directory.
637 * Removed macro header definitions
638 eg: #include "types.h"
639 #include "ztypes.h" etc..
641 * Added macro header definitions
642 eg: #include <polylib/polylib.h>
644 * Changes in local variable names or types in function declarations
646 (1) SolveDiophantine : int *C -> Value *C
651 * Comments added wherever seemed appropriate.
653 * Changes in almost all the functions in order to make it generic and
654 allow handling of all the 'Value' types including GMP.
658 * Programming code changed from K&R C to ANSI C.
661 eg: void Vector_Copy(Value *,Value *,unsigned)
662 void Vector_Exchange(Value *,Value *,unsigned)
664 * Changes in parameter names or return type in function declarations
666 (1) Factorial : return type changed to (Value *) from (Value)
667 (2) Binomial : return type changed to (Value *) from (Value)
668 (3) CNP : return type changed to (Value *) from (Value)
669 (4) GCD : return type changed to (Value *) from (Value)
670 (5) Vector_Free : vec -> vector
671 (6) Vector_Print : vec -> vector
672 (7) Vector_Set : Value n -> int n
673 (8) Inner_Product : return type changed to (Value *) from
675 (9) Vector_Max : return type changed to (Value *) from (Value)
676 (10) Vector_Min : return type changed to (Value *) from (Value)
677 (11) Vector_Min_Not_Zero : return type changed to (Value *)
679 (12) Vector_Gcd : return type changed to (Value *) from (Value)
681 (13) Vector_Map : Value (*f)() -> Value *(*f)()
682 (14) Vector_Normalize : q (deleted)
683 (15) Vector_Normalize_Positive : tmp (deleted)
684 (16) Vector_Reduce : return type changed to (Value *) from
686 Value (*f)() -> Value *(*f)()
687 (17) Vector_Sort : Vecv -> vector
689 * Changes in local variable names or types in function declarations
691 (1) Factorial : Value fact -> Value *fact
693 (2) Binomial : Value prod -> Value *result
694 f (deleted), tmp (added)
695 (3) CNP : Value c -> Value *result
697 (4) GCD : Value aux -> Value *result
699 (5) Vector_Alloc : vec -> vector
701 (6) Vector_Free : i (added)
702 (7) Vector_Read : vec -> vector
704 (8) Inner_Product : Value ip -> Value *ip
706 (9) Vector_Max : Value max -> Value *max
707 (10) Vector_Min : Value min -> Value *min
708 (11) Vector_Min_Not_Zero : Value min -> Value *min
710 (12) Vector_Gcd : Value min -> Value *min
712 (13) Vector_Normalize : Value gcd -> Value *gcd
714 (14) Vector_Normalize_positive : Value g -> Value *gcd
715 (15) Vector_Reduce : Value r -> Value *r
717 * Comments added wherever seemed appropriate.
719 * Changes in almost all the functions in order to make it generic and
720 allow handling of all the 'Value' types including GMP.
724 * Changes in local variable names or types in function declarations
726 (1) check_poly : Value k -> int k
728 (2) main : tmp (added)
730 * Changes in almost all the functions in order to make it generic and
731 allow handling of all the 'Value' types including GMP.
733 (15) Zpolyhedron.c ->
735 * Added file "Zpolyhderon.c" in ./source directory.
737 * A few macro definitions removed:
738 eg: #include "types.h"
740 #include "vector.h", etc....
742 * A few macro definitions added:
743 eg: #include "polylib/polylib.h"
745 * Changes in local variable names or types in function declarations
747 (1) CanonicalForm : tmp (added)
749 * Comments added wherever seemed appropriate.
751 * Changes in almost all the functions in order to make it generic and
752 allow handling of all the 'Value' types including GMP.
756 * Added file "Zpolytest.c" in ./source directory.
758 * A few macro definitions removed:
759 eg: #include "types.h"
761 #include "vector.h", etc....
763 * A few macro definitions added:
764 eg: #include "polylib/polylib.h"
766 *******************************************************************************