19unsigned int nb_bits(
unsigned long long int x) {
20 unsigned int i,
n = 0;
21 unsigned long long int y = x;
22 for (i = 0; i < 64; i++) {
35 unsigned int *inv_perm =
36 (
unsigned int *)malloc(
sizeof(
unsigned int) * nb_elems);
37 for (i = 0; i < nb_elems; i++)
38 inv_perm[perm[i]] = i;
56 for (i = 0; i < transf->
NbRows; i++) {
57 for (j = 0; j < transf->
NbRows; j++) {
72 for (i = 0; i < polyh->
NbRows; i++) {
75 value_assign(permuted->
p[i][permutation[j - 1] + 1], polyh->
p[i][j]);
94 for (i = 0; i < C->
NbRows; i++) {
117 unsigned long long int combination;
118 unsigned int i, j, k;
120 Matrix *Square_Mat, *Eqs2;
121 unsigned nb_vars = end - start + 1;
124 assert(start > 0 && end < Eqs->NbColumns - 1);
127 if (Eqs->
NbRows > nb_vars) {
133 if (
emptyQ(OverConstrained)) {
141 for (i = 0; i < Eqs->
NbRows; i++) {
153 for (combination = ((
unsigned long long int)1 << (Eqs->
NbRows)) - 1;
154 (combination < ((
unsigned long long int)1 << nb_vars)); combination++) {
158 for (j = 0; j < nb_vars; j++) {
159 if ((combination >> j) % 2) {
160 for (i = 0; i < Eqs->
NbRows; i++) {
182 return (
unsigned long long int)0;
192 unsigned int i, j, k;
193 int nb_vars = Eqs->
NbColumns - nb_parms - 2;
194 unsigned long long int combination;
195 unsigned int *permutation =
196 (
unsigned int *)malloc(
sizeof(
unsigned int) * Eqs->
NbColumns - 1);
207 for (i = 0; i < nb_vars; i++) {
209 if (combination % 2) {
215 permutation[i] = Eqs->
NbRows + nb_parms + i - k;
219 for (i = 0; i < nb_parms; i++) {
220 permutation[nb_vars + i] = Eqs->
NbRows + i;
234 unsigned int nb_keep,
235 unsigned int nb_vars_parms,
236 unsigned int nb_parms) {
237 unsigned int *permutation =
238 (
unsigned int *)malloc(
sizeof(
unsigned int) * nb_vars_parms + 1);
242 for (i = 0; i < nb_vars_parms - nb_parms; i++) {
243 if (i == vars_to_keep[cur_keep]) {
244 permutation[i] = nb_vars_parms - nb_keep + cur_keep;
247 permutation[i] = cur_go;
252 for (i = 0; i < nb_parms; i++)
253 permutation[i + nb_vars_parms - nb_parms] =
254 i + nb_vars_parms - nb_parms - nb_keep;
257 permutation[nb_vars_parms] = nb_vars_parms;
Matrix * Matrix_Copy(Matrix const *Src)
#define value_notzero_p(val)
#define value_assign(v1, v2)
Matrix * Matrix_Alloc(unsigned NbRows, unsigned NbColumns)
void right_hermite(Matrix *A, Matrix **Hp, Matrix **Up, Matrix **Qp)
void Matrix_Free(Matrix *Mat)
void Constraints_permute(Matrix *C, unsigned int *perm, Matrix **Cp)
permutes the variables of the constraints of a polyhedron
unsigned int * permutation_inverse(unsigned int *perm, unsigned int nb_elems)
Gives the inverse permutation vector of a permutation vector.
unsigned long long int eliminable_vars(Matrix *Eqs, unsigned start, unsigned end)
Given a set of equalities, find a set of variables that can be eliminated using these equalities.
Matrix * mpolyhedron_permute(Matrix *polyh, unsigned int *permutation)
permutes the variables of the constraints of a polyhedron
Matrix * mtransformation_permute(Matrix *transf, unsigned int *permutation)
Given a linear tranformation on initial variables, and a variable permutation, computes the tranforma...
unsigned int nb_bits(unsigned long long int x)
utility function : bit count (i know, there are faster methods)
unsigned int * find_a_permutation(Matrix *Eqs, unsigned int nb_parms)
finds a valid permutation : for a set of m equations, find m variables that will be put at the beginn...
unsigned int * permutation_for_full_dim2(unsigned int *vars_to_keep, unsigned int nb_keep, unsigned int nb_vars_parms, unsigned int nb_parms)
computes the permutation of variables and parameters, according to some variables to keep.
void Polyhedron_Free(Polyhedron *Pol)
Polyhedron * Constraints2Polyhedron(Matrix *Constraints, unsigned NbMaxRays)
Given a matrix of constraints ('Constraints'), construct and return a polyhedron.
int Vector_IsZero(Value *v, unsigned length)