polylib 5.22.8
matrix_permutations.h
Go to the documentation of this file.
1/**
2 * Permutations on matrices
3 * Matrices are seen either as transformations (mtransformation) or as
4 * polyhedra (mpolyhedron or Constraints).
5 * @author B. Meister
6 */
7
8#ifndef __BM_MATRIX_PERMUTATIONS_H__
9#define __BM_MATRIX_PERMUTATIONS_H__
10
11#include <assert.h>
12#include <polylib/polylib.h>
13
14/* Permutations here are vectors that give the future position for each
15 variable */
16
17/* utility function : bit count */
18unsigned int nb_bits(unsigned long long int x);
19
20/* gives the inverse permutation vector of a permutation vector */
21unsigned int *permutation_inverse(unsigned int *perm, unsigned int nb_elems);
22
23/*
24 * Given a linear tranformation on initial variables, and a variable
25 * permutation, compute the tranformation for the permuted variables. perm is
26 * a vector giving the new "position of the k^th variable, k \in [1..n] we can
27 * call it a "permutation vector" if you wish transf[x][y] ->
28 * permuted[permutation(x)][permutation(y)]
29 */
30Matrix *mtransformation_permute(Matrix *transf, unsigned int *permutation);
31
32/* permutes the variables of a matrix seen as a polyhedron */
33Matrix *mpolyhedron_permute(Matrix *polyh, unsigned int *permutation);
34
35/* permutes the variables of a matrix seen as a polyhedron */
36void Constraints_permute(Matrix *C, unsigned int *perm, Matrix **Cp);
37
38/** Given a set of <i>equalities</i>, find a set of variables that can be
39 * eliminated using these equalities. The variables that we agree to eliminate
40 * are in a zone of contiguous variables (or parameters). <p>
41 * Notes:
42 <ul>
43 <li>brute force, surely enhanceable algorithm</li>
44 <li>limited number of variables in the zone: limit = bitwidth of long long
45 </ul>
46 * @param Eqs the matrix of equalities.
47 * @param start the rank of the first variable (inclusive) of the zone in Eqs
48 * @param end the rank of the last variable (inclusive) of the zone
49 * return a bitfield where bits set to one define the variables to eliminate
50*/
51unsigned long long int eliminable_vars(Matrix *Eqs, unsigned start,
52 unsigned end);
53
54/*
55 * find a valid permutation : for a set of m equations, find m variables that
56 * will be put at the beginning (to be eliminated) it must be possible to
57 * eliminate these variables : the submatrix built with their columns must be
58 * full-rank. brute force method, that tests all the combinations until finding
59 * one which works.
60 * <b>LIMITATIONS</b> : up to x-1 variables, where the long long
61 * format is x-1 bits (often 64 in year 2005).
62 */
63unsigned int *find_a_permutation(Matrix *Eqs, unsigned int nb_parms);
64
65/*
66 * compute the permutation of variables and parameters, according to some
67 * variables to keep. put the variables not to be kept at the beginning, then
68 * the parameters and finally the variables to be kept. strongly related to the
69 * function compress_to_full_dim2
70 */
71unsigned int *permutation_for_full_dim2(unsigned int *vars_to_keep,
72 unsigned int nb_keep,
73 unsigned int nb_vars_parms,
74 unsigned int nb_parms);
75
76#endif /*__BM_MATRIX_PERMUTATIONS_H__ */
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)
Permutations on matrices Matrices are seen either as transformations (mtransformation) or as polyhedr...
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.
Definition: types.h:75