41 errormsg1(
"exist_points",
"infdom",
"infinite domain");
101 context = (Value *)malloc((P->
Dimension + 2) *
sizeof(Value));
132 int res, dim, i, j, k;
137 errormsg1(
"PolyhedronLTQ",
"compoly",
"Can only compare polyhedra");
141 errormsg1(
"PolyhedronLTQ",
"diffdim",
"Polyhedra are not same dimension");
152 fprintf(stdout,
"P1\n");
154 fprintf(stdout,
"P2\n");
162 for (j = 0, i = INDEX; j < k; i++, j++)
165 Q1 =
AddRays(Mat->
p[0], k, Pol1, NbMaxConstrs);
166 Q2 =
AddRays(Mat->
p[0], k, Pol2, NbMaxConstrs);
169 fprintf(stdout,
"Q1\n");
171 fprintf(stdout,
"Q2\n");
179 fprintf(stdout,
"Q\n");
193 fprintf(stdout,
"Q1\n");
195 fprintf(stdout,
"Q2\n");
210 for (k = 0; k < dim; k++)
220 for (k = 0; k < dim; k++)
229 fprintf(stderr,
"Q4 surrounding polyhedron\n");
238 fprintf(stderr,
"Surrounding polyhedron is empty\n");
261 for (k = 1; k < dim; k++)
268 for (k = 1; k < dim; k++)
275 for (k = 1; k < dim; k++)
294 for (k = 1; k < dim; k++)
300 for (k = 1; k < dim; k++)
307 for (k = 1; k < dim; k++)
316 fprintf(stdout,
"i=%d j=%d M=\n", i + 1, j + 1);
324 fprintf(stdout,
"Q3\n");
332 fprintf(stdout,
"not empty\n");
338 fprintf(stdout,
"empty\n");
354 fprintf(stdout,
"res = %d\n", res);
367 int NbRows = Mat1->
NbRows;
370 int i, j, k,
n, t, pivot, Rank;
373 column_index = (
int *)malloc(NbCols *
sizeof(
int));
375 errormsg1(
"GaussSimplify",
"outofmem",
"out of memory space\n");
385 for (j = 0; j < NbCols; j++) {
386 for (i = Rank; i < NbRows; i++)
400 for (k = 0; k < NbCols; k++, cp++)
405 for (k = 0; k < NbCols; k++, cp++)
410 for (i = 0; i < NbRows; i++)
413 Value a, a1, a2, a1abs, a2abs;
437 column_index[Rank] = j;
452 for (k = 0; k < Rank; k++) {
454 for (i = 0; i < (Mat2->
NbRows - 1);
459 Value a, a1, a1abs, a2, a2abs;
487 for (
n = j + 1;
n < (NbCols - 1);
n++) {
500 for (j = 0; j < (NbCols - 1); j++)
502 errormsg1(
"GaussSimplify",
"corrtrans",
"Corrupted transformation\n");
507 errormsg1(
"GaussSimplify",
"corrtrans",
"Corrupted transformation\n");
526 unsigned int pdim,
int *time,
int *pvect,
529 unsigned int const nbcells =
530 ((
n * (
n - 1)) >> 1);
534 unsigned int i, j, k;
535 unsigned int t, nb, isroot;
558 dag = (
int *)malloc(nbcells *
sizeof(
int));
561 p = (
int **)malloc((
n - 1) *
sizeof(
int *));
569 for (i = 1; i <
n - 1; i++)
570 p[i] = p[i - 1] + (
n - 1) - i;
571 for (i = 0; i < nbcells; i++)
573 for (i = 0; i <
n; i++)
578 for (i = 0; i <
n - 1; i++) {
581 for (j = i + 1; j <
n; j++) {
593 for (k = 0; k < i; k++)
594 if (p[k][i] == p[i][j])
598 for (k = i + 1; k < j; k++)
599 if (p[i][k] == -p[i][j])
603 for (k = j + 1; k <
n; k++)
604 if (p[i][k] == -p[i][j])
622 for (i = 0; i <
n; i++) {
630 for (j = 0; j < i; j++) {
637 for (j = i + 1; j <
n; j++) {
653 for (i = 0; i <
n; i++) {
655 for (j = 0; j < i; j++)
657 for (j = i + 1; j <
n; j++)
int PolyhedronLTQ(Polyhedron *Pol1, Polyhedron *Pol2, int INDEX, int PDIM, int NbMaxConstrs)
static int exist_points(int pos, Polyhedron *Pol, Value *context)
int Polyhedron_Not_Empty(Polyhedron *P, Polyhedron *C, int MAXRAYS)
int PolyhedronTSort(Polyhedron **L, unsigned int n, unsigned int index, unsigned int pdim, int *time, int *pvect, unsigned int MAXRAYS)
int GaussSimplify(Matrix *Mat1, Matrix *Mat2)
#define value_oppose(ref, val)
#define value_notzero_p(val)
#define value_divexact(ref, val1, val2)
#define value_gcd(ref, val1, val2)
#define value_notone_p(val)
#define value_absolute(ref, val)
#define value_zero_p(val)
#define value_assign(v1, v2)
#define value_increment(ref, val)
#define value_set_si(val, i)
#define value_division(ref, val1, val2)
#define value_subtract(ref, val1, val2)
void errormsg1(const char *f, const char *msgname, const char *msg)
Matrix * Matrix_Alloc(unsigned NbRows, unsigned NbColumns)
void Matrix_Print(FILE *Dst, const char *Format, Matrix *Mat)
void Matrix_Free(Matrix *Mat)
Polyhedron * AddRays(Value *AddedRays, unsigned NbAddedRays, Polyhedron *Pol, unsigned NbMaxConstrs)
Add 'NbAddedRays' rays to polyhedron 'Pol'.
Polyhedron * Polyhedron_Scan(Polyhedron *D, Polyhedron *C, unsigned NbMaxRays)
Polyhedron * DomainIntersection(Polyhedron *Pol1, Polyhedron *Pol2, unsigned NbMaxRays)
Return the intersection of two polyhedral domains 'Pol1' and 'Pol2'.
int lower_upper_bounds(int pos, Polyhedron *P, Value *context, Value *LBp, Value *UBp)
Polyhedron * AddConstraints(Value *Con, unsigned NbConstraints, Polyhedron *Pol, unsigned NbMaxRays)
void Polyhedron_Print(FILE *Dst, const char *Format, const Polyhedron *Pol)
void Domain_Free(Polyhedron *Pol)
#define POL_ENSURE_VERTICES(P)
#define POL_ENSURE_FACETS(P)
void Vector_Set(Value *p, int n, unsigned length)
void Vector_Combine(Value *p1, Value *p2, Value *p3, Value lambda, Value mu, unsigned length)
void Vector_Gcd(Value *p, unsigned length, Value *min)
void Vector_Exchange(Value *p1, Value *p2, unsigned length)
void Vector_Normalize(Value *p, unsigned length)