19#define TEST(a) if ((isOk = (a))) { \
20 printf(#a" tested ok.\n"); \
23 printf(#a" NOT OK\n"); \
31 unsigned int nbSamples);
34 {
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z"};
36int main(
int argc,
char ** argv) {
40 printf(
"Warning: No arguments taken into account: testing"
41 "remove_parm_eqs().\n");
61 Matrix * M, *C, *Cp, * Eqs, *M1, *C1;
63 unsigned int * elimParms;
64 printf(
"----- test_Constraints_Remove_parm_eqs() -----\n");
85 printf(
"Removed equalities: \n");
87 printf(
"Polyhedron without equalities involving only parameters: \n");
89 printf(
"Context without equalities: \n");
130 Polyhedron *Pm, *Pc, *Pcp, *Peqs, *Pint, *Pint1;
131 unsigned int * elimParms;
132 printf(
"----- test_Polyhedron_Remove_parm_eqs() -----\n");
192 if (*newParms==NULL) {
195 if (elimParms[0] ==0) {
196 for (i=0; i< origParms->
NbColumns; i++) {
200 for (i=0; i< origParms->
NbColumns; i++) {
201 if (i!=elimParms[j+1]) {
223 unsigned int * elimParms,
224 const char ***newParms)
227 unsigned int newSize = nbParms -elimParms[0];
229 printf(
"Size of the new parm vector: %d\n", newSize);
231 if (*newParms==NULL) {
232 *newParms = malloc(newSize*
sizeof(
char *));
234 if (elimParms[0]==0) {
235 for (i=0; i< nbParms; i++) {
236 (*newParms)[i] = strdup(parms[i]);
240 for (i=0; i< nbParms; i++) {
241 if (i!=elimParms[j+1]) {
242 (*newParms)[i-j] = strdup(parms[i]);
262 unsigned int nbSamples) {
263 Matrix * Eqs= NULL, *ParmEqs=NULL, *VL=NULL;
264 unsigned int * elimVars=NULL, * elimParms=NULL;
265 Matrix * sample, * smallerSample=NULL;
266 Matrix * transfSample=NULL;
268 unsigned int i, j, r, nbOrigParms, nbParms;
269 Value div, mod, *origVal=NULL, *fullVal=NULL;
274 const char **fullNames = NULL;
294 &elimVars, &elimParms,
maxRays);
295 if ((Eqs->
NbRows==0) && (ParmEqs->NbRows==0)) {
328 for (i = 0; i< nbSamples; i++) {
330 for (j=0; j< nbOrigParms; j++) {
337 for (r = 0; r < nbParms; r++) {
339 &(transfSample->
p[0][r]));
354 if (origEP ==NULL)
break;
357 if (!
value_eq(*origVal, *fullVal)) {
359 printf(
"EPs don't match. \n Original value = ");
361 printf(
"\n Original sample = [");
366 printf(
"] \n EP = ");
373 printf(
" \n Full-dimensional value = ");
375 printf(
"\n full-dimensional sample = [");
380 printf(
"] \n EP = ");
389 printf(
"\nOriginal value = ");
391 printf(
"\nFull-dimensional value = ");
Matrix * Matrix_Copy(Matrix const *Src)
#define value_pdivision(ref, val1, val2)
#define value_zero_p(val)
#define value_assign(v1, v2)
#define value_set_si(val, i)
#define value_print(Dst, fmt, val)
#define value_subtract(ref, val1, val2)
#define value_addto(ref, val1, val2)
void Constraints_fullDimensionize(Matrix **M, Matrix **C, Matrix **VL, Matrix **Eqs, Matrix **ParmEqs, unsigned int **elimVars, unsigned int **elimParms, int maxRays)
Eliminates all the equalities in a set of constraints and returns the set of constraints defining a f...
Matrix * Constraints_Remove_parm_eqs(Matrix **M1, Matrix **Ctxt1, int renderSpace, unsigned int **elimParms)
Removes the equalities that involve only parameters, by eliminating some parameters in the polyhedron...
void Lattice_extractSubLattice(Matrix *lat, unsigned int k, Matrix **subLat)
Given a matrix that defines a full-dimensional affine lattice, returns the affine sub-lattice spanned...
Polyhedron * Polyhedron_Remove_parm_eqs(Polyhedron **P, Polyhedron **C, int renderSpace, unsigned int **elimParms, int maxRays)
Removes equalities involving only parameters, but starting from a Polyhedron and its context.
Enumeration * Polyhedron_Enumerate(Polyhedron *Pi, Polyhedron *C, unsigned MAXRAYS, const char **param_name)
Procedure to count points in a parameterized polytope.
Enumeration * Enumeration_zero(unsigned int nbParms, unsigned int maxRays)
returns a constant Ehrhart polynomial whose value is zero for any value of the parameters.
void print_evalue(FILE *DST, evalue *e, const char **pname)
void Enumeration_Free(Enumeration *en)
Value * compute_poly(Enumeration *en, Value *list_args)
Matrix * Matrix_Alloc(unsigned NbRows, unsigned NbColumns)
Matrix * Matrix_Read(void)
int MatInverse(Matrix *Mat, Matrix *MatInv)
void Matrix_Free(Matrix *Mat)
#define show_matrix(M)
Polylib matrix addons Mainly, deals with polyhedra represented in implicit form (set of constraints).
int PolyhedronIncludes(Polyhedron *Pol1, Polyhedron *Pol2)
Polyhedron * align_context(Polyhedron *Pol, int align_dimension, int NbMaxRays)
void Polyhedron_Free(Polyhedron *Pol)
Polyhedron * DomainIntersection(Polyhedron *Pol1, Polyhedron *Pol2, unsigned NbMaxRays)
Return the intersection of two polyhedral domains 'Pol1' and 'Pol2'.
Polyhedron * Constraints2Polyhedron(Matrix *Constraints, unsigned NbMaxRays)
Given a matrix of constraints ('Constraints'), construct and return a polyhedron.
int test_Constraints_fullDimensionize(Matrix *A, Matrix *B, unsigned int nbSamples)
Tests Constraints_fullDimensionize by comparing the Ehrhart polynomials.
int test_Constraints_Remove_parm_eqs(Matrix *A, Matrix *B)
extracts the equalities involving the parameters only, try to introduce them back and compare the two...
int main(int argc, char **argv)
unsigned int namesWithoutElim(const char **parms, unsigned nbParms, unsigned int *elimParms, const char ***newParms)
takes a list of parameter names, a list ofparameters to eliminate, and returns the list of parameters...
int test_Polyhedron_Remove_parm_eqs(Matrix *A, Matrix *B)
extracts the equalities holding on the parameters only, try to introduce them back and compare the tw...
void valuesWithoutElim(Matrix *origParms, unsigned int *elimParms, Matrix **newParms)
Eliminates certain parameters from a vector of values for parameters.
void Inner_Product(Value *p1, Value *p2, unsigned length, Value *ip)