00001 /** 00002 * @author B. Meister 12/2003-2006 00003 * LSIIT -ICPS 00004 * UMR 7005 CNRS 00005 * Louis Pasteur University (ULP), Strasbourg, France 00006 */ 00007 #ifndef __BM_COMPRESS_PARMS_H__ 00008 #define __BM_COMPRESS_PARMS_H__ 00009 00010 #include "matrix_addon.h" 00011 #include "matrix_permutations.h" 00012 #include <assert.h> 00013 00014 00015 /* ----- functions applying on equalities ----- */ 00016 00017 /** 00018 * Given a system of non-redundant equalities, looks if it has an integer 00019 * solution in the combined space, and if yes, returns one solution. 00020 */ 00021 void Equalities_integerSolution(Matrix * Eqs, Matrix ** sol); 00022 00023 /** 00024 * Computes the validity lattice of a set of equalities. I.e., the lattice 00025 * induced on the last <tt>b</tt> variables by the equalities involving the 00026 * first <tt>a</tt> integer existential variables. 00027 */ 00028 void Equalities_validityLattice(Matrix * Eqs, int a, Matrix** vl); 00029 00030 /** 00031 * Given an integer matrix B with m rows and integer m-vectors C and d, 00032 * computes the basis of the integer solutions to (BN+C) mod d = 0 (1). 00033 * This is an affine lattice (G): (N 1)^T= G(N' 1)^T, forall N' in Z^b. 00034 * If there is no solution, returns NULL. 00035 */ 00036 void Equalities_intModBasis(Matrix * B, Matrix * C, Matrix * d, Matrix ** imb); 00037 00038 00039 /* ----- functions applying on constraints ----- */ 00040 00041 00042 /** 00043 * Eliminates all the equalities in a set of constraints and returns the set of 00044 * constraints defining a full-dimensional polyhedron, such that there is a 00045 * bijection between integer points of the original polyhedron and these of the 00046 * resulting (projected) polyhedron). 00047 */ 00048 void Constraints_fullDimensionize(Matrix ** M, Matrix ** C, Matrix ** VL, 00049 Matrix ** Eqs, Matrix ** ParmEqs, 00050 unsigned int ** elimVars, 00051 unsigned int ** elimParms, 00052 int maxRays); 00053 00054 /* extracts equalities involving only parameters */ 00055 #define Constraints_removeParmEqs(a,b,c,d) Constraints_Remove_parm_eqs(a,b,c,d) 00056 Matrix * Constraints_Remove_parm_eqs(Matrix ** M, Matrix ** Ctxt, 00057 int renderSpace, 00058 unsigned int ** elimParms); 00059 00060 /** 00061 * Eliminates the columns corresponding to a list of eliminated parameters. 00062 */ 00063 void Constraints_removeElimCols(Matrix * M, unsigned int nbVars, 00064 unsigned int *elimParms, Matrix ** newM); 00065 00066 00067 /* ----- function applying on a lattice ----- */ 00068 00069 /** 00070 * Given a matrix that defines a full-dimensional affine lattice, returns the 00071 * affine sub-lattice spanned in the k first dimensions. 00072 * Useful for instance when you only look for the parameters' validity lattice. 00073 */ 00074 void Lattice_extractSubLattice(Matrix * lat, unsigned int k, Matrix ** subLat); 00075 00076 00077 /* ----- functions applying on a polyhedron ----- */ 00078 00079 00080 Polyhedron * Polyhedron_Remove_parm_eqs(Polyhedron ** P, Polyhedron ** C, 00081 int renderSpace, 00082 unsigned int ** elimParms, 00083 int maxRays); 00084 #define Polyhedron_removeParmEqs(a,b,c,d,e) Polyhedron_Remove_parm_eqs(a,b,c,d,e) 00085 00086 00087 /* ----- functions kept for backwards compatibility ----- */ 00088 00089 00090 /** 00091 * given a full-row-rank nxm matrix M(made of row-vectors), 00092 * computes the basis K (made of n-m column-vectors) of the integer kernel of M 00093 * so we have: M.K = 0 00094 */ 00095 Matrix * int_ker(Matrix * M); 00096 00097 /* given a matrix of m parameterized equations, compress the parameters and 00098 transform the variable space into a n-m space. */ 00099 Matrix * full_dimensionize(Matrix const * M, int nb_parms, 00100 Matrix ** Validity_Lattice); 00101 00102 /* Compute the overall period of the variables I for (MI) mod |d|, 00103 where M is a matrix and |d| a vector 00104 Produce a diagonal matrix S = (s_k) where s_k is the overall period of i_k */ 00105 Matrix * affine_periods(Matrix * M, Matrix * d); 00106 00107 /* given a matrix B' with m rows and m-vectors C' and d, computes the 00108 basis of the integer solutions to (B'N+C') mod d = 0. 00109 returns NULL if there is no integer solution */ 00110 Matrix * int_mod_basis(Matrix * Bp, Matrix * Cp, Matrix * d); 00111 00112 /* given a parameterized constraints matrix with m equalities, computes the 00113 compression matrix C such that there is an integer solution in the variables 00114 space for each value of N', with N = Cmp N' (N are the original parameters) */ 00115 Matrix * compress_parms(Matrix * E, int nb_parms); 00116 00117 00118 #endif /* __BM_COMPRESS_PARMS_H__ */