polylib 5.22.8
matrix_permutations.c File Reference
#include <polylib/matrix_permutations.h>
#include <stdlib.h>

Go to the source code of this file.

Functions

unsigned int nb_bits (unsigned long long int x)
 utility function : bit count (i know, there are faster methods) More...
 
unsigned int * permutation_inverse (unsigned int *perm, unsigned int nb_elems)
 Gives the inverse permutation vector of a permutation vector. More...
 
Matrixmtransformation_permute (Matrix *transf, unsigned int *permutation)
 Given a linear tranformation on initial variables, and a variable permutation, computes the tranformation for the permuted variables. More...
 
Matrixmpolyhedron_permute (Matrix *polyh, unsigned int *permutation)
 permutes the variables of the constraints of a polyhedron More...
 
void Constraints_permute (Matrix *C, unsigned int *perm, Matrix **Cp)
 permutes the variables of the constraints of a polyhedron More...
 
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. More...
 
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 beginning (to be eliminated). More...
 
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. More...
 

Function Documentation

◆ Constraints_permute()

void Constraints_permute ( Matrix C,
unsigned int *  perm,
Matrix **  Cp 
)

permutes the variables of the constraints of a polyhedron

Parameters
Cthe original set of constraints
perma permutation vector
Cp(returned) the set of constraints whose variables are permuted. Allocated if set to NULL, assumed to be already allocated if not.

Definition at line 87 of file matrix_permutations.c.

References assert, Matrix_Alloc(), matrix::NbColumns, matrix::NbRows, matrix::p, and value_assign.

Referenced by Constraints_fullDimensionize().

◆ eliminable_vars()

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.

The variables that we agree to eliminate are in a zone of contiguous variables (or parameters).

Notes:

  • brute force, surely enhanceable algorithm
  • limited number of variables in the zone: limit = bitwidth of long long
Parameters
Eqsthe matrix of equalities.
startthe rank of the first variable (inclusive) of the zone in Eqs
endthe rank of the last variable (inclusive) of the zone return a bitfield where bits set to one define the variables to eliminate

Definition at line 115 of file matrix_permutations.c.

References assert, Constraints2Polyhedron(), emptyQ, Matrix_Alloc(), Matrix_Copy(), Matrix_Free(), nb_bits(), matrix::NbColumns, matrix::NbRows, matrix::p, Polyhedron_Free(), right_hermite(), value_assign, value_notzero_p, and Vector_IsZero().

Referenced by find_a_permutation().

◆ find_a_permutation()

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 beginning (to be eliminated).

Note: inherits the limited the number of variables from eliminable_vars

Definition at line 191 of file matrix_permutations.c.

References eliminable_vars(), matrix::NbColumns, and matrix::NbRows.

Referenced by Constraints_fullDimensionize(), and full_dimensionize().

◆ mpolyhedron_permute()

Matrix * mpolyhedron_permute ( Matrix polyh,
unsigned int *  permutation 
)

permutes the variables of the constraints of a polyhedron

Parameters
polyhthe constraints of the polyhedron
permutationa permutation vector

Definition at line 69 of file matrix_permutations.c.

References Matrix_Alloc(), matrix::NbColumns, matrix::NbRows, matrix::p, and value_assign.

Referenced by full_dimensionize().

◆ mtransformation_permute()

Matrix * mtransformation_permute ( Matrix transf,
unsigned int *  permutation 
)

Given a linear tranformation on initial variables, and a variable permutation, computes the tranformation for the permuted variables.

perm is a vector giving the new "position of the k^th variable, k \in [1..n] we can call it a "permutation vector" if you wish transf[x][y] -> permuted[permutation(x)][permutation(y)]

Definition at line 49 of file matrix_permutations.c.

References assert, Matrix_Alloc(), matrix::NbColumns, matrix::NbRows, matrix::p, and value_assign.

◆ nb_bits()

unsigned int nb_bits ( unsigned long long int  x)

utility function : bit count (i know, there are faster methods)

Permutations on matrices Matrices are seen either as transformations (mtransformation) or as polyhedra (mpolyhedron or Constraints).

Id
matrix_permutations.c,v 1.8 2006/10/01 02:10:46 meister Exp

Permutations on matrices Matrices are seen either as transformations (mtransformation) or as polyhedra (mpolyhedron)

Author
B. Meister LSIIT -ICPS UMR 7005 CNRS Louis Pasteur University (ULP), Strasbourg, France

Permutations are just indirection vectors: the k^th element of a permutation vector is the position of the k^th variable in the permuted object.

Definition at line 19 of file matrix_permutations.c.

References n.

Referenced by eliminable_vars().

◆ permutation_for_full_dim2()

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.

put the variables not to be kept at the beginning, then the parameters and finally the variables to be kept. strongly related to the function compress_to_full_dim2

Definition at line 233 of file matrix_permutations.c.

◆ permutation_inverse()

unsigned int * permutation_inverse ( unsigned int *  perm,
unsigned int  nb_elems 
)

Gives the inverse permutation vector of a permutation vector.

Parameters
permthe permutation vector

Definition at line 33 of file matrix_permutations.c.