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
00023
00024
00025 #define FIRST_PARAMETER_NAME 'P'
00026
00027
00028
00029
00030 #define PCHAR (FIRST_PARAMETER_NAME-1)
00031 #define MAXNOOFRAYS 200
00032
00033 #if defined(LINEAR_VALUE_IS_LONGLONG)
00034 #define P_VALUE_FMT "%4lld "
00035 #elif defined(LINEAR_VALUE_IS_LONG)
00036 #define P_VALUE_FMT "%4ld "
00037 #elif defined(LINEAR_VALUE_IS_CHARS)
00038 #define P_VALUE_FMT "%s "
00039 #elif defined(LINEAR_VALUE_IS_INT)
00040 #define P_VALUE_FMT "%4d "
00041 #else
00042 #define P_VALUE_FMT "%4s"
00043 #endif
00044
00045
00046 #define LB_INFINITY 1
00047 #define UB_INFINITY 2
00048
00049
00050
00051 #define MSB ((unsigned)(((unsigned)1)<<(sizeof(int)*8-1)))
00052
00053
00054 #define TOP ((int)(MSB-1))
00055
00056
00057 #define NEXT(j,b) { if (!((b)>>=1)) { (b)=MSB; (j)++; } }
00058
00059
00060 extern int Pol_status;
00061
00062 typedef struct {
00063 unsigned Size;
00064 Value *p;
00065 } Vector;
00066
00067 typedef struct matrix {
00068 unsigned NbRows, NbColumns;
00069 Value **p;
00070 Value *p_Init;
00071 int p_Init_size;
00072 } Matrix;
00073
00074 typedef struct polyhedron {
00075 unsigned Dimension, NbConstraints, NbRays, NbEq, NbBid;
00076 Value **Constraint;
00077 Value **Ray;
00078 Value *p_Init;
00079 int p_Init_size;
00080 struct polyhedron *next;
00081 } Polyhedron;
00082
00083 typedef struct interval {
00084 Value MaxN, MaxD;
00085 Value MinN, MinD;
00086 int MaxI, MinI;
00087 } Interval;
00088
00089
00090 #define emptyQ(P) (P->NbRays==0)
00091
00092
00093 #define universeQ(P) (P->Dimension==P->NbLines)
00094
00095 typedef struct _Param_Vertex {
00096 Matrix *Vertex;
00097
00098
00099
00100 Matrix *Domain;
00101 struct _Param_Vertex *next;
00102 } Param_Vertices;
00103
00104 typedef struct _Param_Domain {
00105 unsigned *F;
00106 Polyhedron *Domain;
00107 struct _Param_Domain *next;
00108 } Param_Domain;
00109
00110 typedef struct _Param_Polyhedron {
00111 int nbV;
00112 Param_Vertices *V;
00113 Param_Domain *D;
00114 } Param_Polyhedron;
00115
00116 #define FORALL_PVertex_in_ParamPolyhedron(_V, _D, _P) \
00117 { int _i, _ix; \
00118 unsigned _bx; \
00119 for( _i=0, _ix=0, _bx=MSB, _V=_P->V ; \
00120 _V && (_i<_P->nbV) ; _i++, _V=_V->next ) \
00121 { if (_D->F[_ix] & _bx) \
00122 {
00123
00124 #define END_FORALL_PVertex_in_ParamPolyhedron \
00125 } \
00126 NEXT(_ix, _bx); \
00127 } \
00128 }
00129
00130
00131
00132 typedef enum { polynomial, periodic, evector } enode_type;
00133
00134 typedef struct _evalue {
00135 Value d;
00136 union {
00137 Value n;
00138 struct _enode *p;
00139 } x;
00140 } evalue;
00141
00142 typedef struct _enode {
00143 enode_type type;
00144 int size;
00145 int pos;
00146 evalue arr[1];
00147 } enode;
00148
00149 typedef struct _enumeration {
00150
00151 Polyhedron *ValidityDomain;
00152 evalue EP;
00153 struct _enumeration *next;
00154
00155
00156 } Enumeration;
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 typedef enum {False = 0, True = 1} Bool;
00180 typedef Matrix Lattice;
00181 typedef struct LatticeUnion {
00182 Lattice *M;
00183 struct LatticeUnion *next;
00184 } LatticeUnion;
00185
00186 typedef struct ZPolyhedron {
00187 Lattice *Lat ;
00188 Polyhedron *P;
00189 struct ZPolyhedron *next;
00190 } ZPolyhedron;
00191
00192 #ifndef FOREVER
00193 #define FOREVER for(;;)
00194 #endif
00195
00196 #endif
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208