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