Home | History | Annotate | Download | only in cloog
      1 #ifndef CLOOG_MATRIX_H
      2 #define CLOOG_MATRIX_H
      3 #if defined(__cplusplus)
      4 extern "C"
      5   {
      6 #endif
      7 
      8 /* The CloogMatrix structure is equivalent to the PolyLib Matrix data structure
      9  * (see Wil93). This structure is devoted to represent a set of constraints.
     10  *
     11  * The whole matrix is stored in memory row after row at the p_Init address. p
     12  * is an array of pointers where p[i] points to the first element of the i^{th
     13  * row. NbRows and NbColumns are respectively the number of rows and columns of
     14  * the matrix. Each row corresponds to a constraint. The first element of each
     15  * row is an equality/inequality tag. The constraint is an equality p(x) = 0 if
     16  * the first element is 0, but it is an inequality p(x) \geq 0 if the first
     17  * element is 1. The next elements are the unknown coefficients, followed by
     18  * the parameter coefficients, then the constant term. For instance, the
     19  * following three constraints:
     20  *
     21  *     -i + m  = 0
     22  *     -j + n >= 0
     23  *  i + j - k >= 0
     24  *
     25  * would be represented by the following rows:
     26  *
     27  * # eq/in  i   j   k   m   n   cst
     28  *     0    0  -1   0   1   0    0
     29  *     1   -1   0   0   0   1    0
     30  *     1    1   1  -1   0   0    0
     31  *
     32  * To be able to provide different precision version (CLooG supports 32 bits,
     33  * 64 bits and arbitrary precision through the GMP library), the cloog_int_t
     34  * type depends on the configuration options (it may be long int for 32 bits
     35  * version, long long int for 64 bits version, and mpz_t for multiple precision
     36  * version). */
     37 
     38 struct cloogmatrix
     39 { unsigned NbRows;    /* Number of rows. */
     40   unsigned NbColumns; /* Number of columns. */
     41   cloog_int_t ** p;         /* Array of pointers to the matrix rows. */
     42   cloog_int_t * p_Init;     /* Matrix rows contiguously in memory. */
     43 };
     44 
     45 typedef struct cloogmatrix CloogMatrix;
     46 
     47 CloogMatrix *cloog_matrix_alloc (unsigned, unsigned);
     48 void cloog_matrix_free (CloogMatrix *);
     49 void cloog_matrix_print_structure(FILE *file, CloogMatrix *M,
     50 		const char *prefix, const char *suffix);
     51 CloogMatrix *cloog_matrix_read(FILE *input);
     52 CloogMatrix *cloog_matrix_read_of_size(FILE *input,
     53 		unsigned n_row, unsigned n_col);
     54 void cloog_matrix_print(FILE*, CloogMatrix*);
     55 
     56 #if defined(__cplusplus)
     57   }
     58 #endif
     59 #endif /* define _H */
     60