00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef _types_polylib_h_
00016 #define _types_polylib_h_
00017
00018 #ifdef GNUMP
00019 #include<gmp.h>
00020 #endif
00021
00022 #include <limits.h>
00023
00024
00025
00026
00027 #define FIRST_PARAMETER_NAME 'P'
00028
00029
00030
00031
00032 #define PCHAR (FIRST_PARAMETER_NAME-1)
00033 #define MAXNOOFRAYS 200
00034
00035 #if defined(LINEAR_VALUE_IS_LONGLONG)
00036 #define P_VALUE_FMT "%4lld "
00037 #elif defined(LINEAR_VALUE_IS_LONG)
00038 #define P_VALUE_FMT "%4ld "
00039 #elif defined(LINEAR_VALUE_IS_CHARS)
00040 #define P_VALUE_FMT "%s "
00041 #elif defined(LINEAR_VALUE_IS_INT)
00042 #define P_VALUE_FMT "%4d "
00043 #else
00044 #define P_VALUE_FMT "%4s "
00045 #endif
00046
00047
00048 #define LB_INFINITY 1
00049 #define UB_INFINITY 2
00050
00051
00052
00053 #define MSB ((unsigned)(((unsigned)1)<<(sizeof(int)*8-1)))
00054
00055
00056 #define TOP ((int)(MSB-1))
00057
00058
00059 #define NEXT(j,b) { if (!((b)>>=1)) { (b)=MSB; (j)++; } }
00060
00061
00062 extern int Pol_status;
00063
00064 #define POL_HIGH_BIT (UINT_MAX - (UINT_MAX >> 1))
00065 #define POL_NO_DUAL (POL_HIGH_BIT | 0x0001)
00066
00067 typedef struct {
00068 unsigned Size;
00069 Value *p;
00070 } Vector;
00071
00072 typedef struct matrix {
00073 unsigned NbRows, NbColumns;
00074 Value **p;
00075 Value *p_Init;
00076 int p_Init_size;
00077 } Matrix;
00078
00079
00080 #define FL_INIT(l, f) (l) = (f)
00081 #define FL_SET(l, f) ((l) |= (f))
00082 #define FL_CLR(l, f) ((l) &= ~(f))
00083 #define FL_ISSET(l, f) ((l) & (f))
00084
00085 #define F_INIT(p, f) FL_INIT((p)->flags, f)
00086 #define F_SET(p, f) FL_SET((p)->flags, f)
00087 #define F_CLR(p, f) FL_CLR((p)->flags, f)
00088 #define F_ISSET(p, f) FL_ISSET((p)->flags, f)
00089
00090 typedef struct polyhedron {
00091 unsigned Dimension, NbConstraints, NbRays, NbEq, NbBid;
00092 Value **Constraint;
00093 Value **Ray;
00094 Value *p_Init;
00095 int p_Init_size;
00096 struct polyhedron *next;
00097 #define POL_INEQUALITIES 0x00000001
00098 #define POL_FACETS 0x00000002
00099 #define POL_POINTS 0x00000004
00100 #define POL_VERTICES 0x00000008
00101
00102
00103
00104 #define POL_VALID 0x00000010
00105 unsigned flags;
00106 } Polyhedron;
00107
00108 typedef struct interval {
00109 Value MaxN, MaxD;
00110 Value MinN, MinD;
00111 int MaxI, MinI;
00112 } Interval;
00113
00114
00115 #define emptyQ(P) (P->NbRays==0)
00116
00117
00118 #define universeQ(P) (P->Dimension==P->NbBid)
00119
00120 typedef struct _Param_Vertex {
00121 Matrix *Vertex;
00122
00123
00124
00125 Matrix *Domain;
00126 struct _Param_Vertex *next;
00127 } Param_Vertices;
00128
00129 typedef struct _Param_Domain {
00130 unsigned *F;
00131 Polyhedron *Domain;
00132 struct _Param_Domain *next;
00133 } Param_Domain;
00134
00135 typedef struct _Param_Polyhedron {
00136 int nbV;
00137 Param_Vertices *V;
00138 Param_Domain *D;
00139 } Param_Polyhedron;
00140
00141 #define FORALL_PVertex_in_ParamPolyhedron(_V, _D, _P) \
00142 { int _i, _ix; \
00143 unsigned _bx; \
00144 for( _i=0, _ix=0, _bx=MSB, _V=_P->V ; \
00145 _V && (_i<_P->nbV) ; _i++, _V=_V->next ) \
00146 { if (_D->F[_ix] & _bx) \
00147 {
00148
00149 #define END_FORALL_PVertex_in_ParamPolyhedron \
00150 } \
00151 NEXT(_ix, _bx); \
00152 } \
00153 }
00154
00155
00156
00157 typedef enum { polynomial, periodic, evector } enode_type;
00158
00159 typedef struct _evalue {
00160 Value d;
00161 union {
00162 Value n;
00163 struct _enode *p;
00164 } x;
00165 } evalue;
00166
00167 typedef struct _enode {
00168 enode_type type;
00169 int size;
00170 int pos;
00171 evalue arr[1];
00172 } enode;
00173
00174 typedef struct _enumeration {
00175
00176 Polyhedron *ValidityDomain;
00177 evalue EP;
00178 struct _enumeration *next;
00179
00180
00181 } Enumeration;
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204 typedef enum {False = 0, True = 1} Bool;
00205 typedef Matrix Lattice;
00206 typedef struct LatticeUnion {
00207 Lattice *M;
00208 struct LatticeUnion *next;
00209 } LatticeUnion;
00210
00211 typedef struct ZPolyhedron {
00212 Lattice *Lat ;
00213 Polyhedron *P;
00214 struct ZPolyhedron *next;
00215 } ZPolyhedron;
00216
00217 #ifndef FOREVER
00218 #define FOREVER for(;;)
00219 #endif
00220
00221 #endif
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233