Add --with-host-libstdcxx configure switch.
[cloog-ppl.git] / source / polylib / matrix.h
blob92f4ff9f72c513b6d992ae4fe13176d03767f800
2 /**-------------------------------------------------------------------**
3 ** CLooG **
4 **-------------------------------------------------------------------**
5 ** matrix.h **
6 **-------------------------------------------------------------------**
7 ** First version: april 17th 2005 **
8 **-------------------------------------------------------------------**/
11 /******************************************************************************
12 * CLooG : the Chunky Loop Generator (experimental) *
13 ******************************************************************************
14 * *
15 * Copyright (C) 2005 Cedric Bastoul *
16 * *
17 * This is free software; you can redistribute it and/or modify it under the *
18 * terms of the GNU General Public License as published by the Free Software *
19 * Foundation; either version 2 of the License, or (at your option) any later *
20 * version. *
21 * *
22 * This software is distributed in the hope that it will be useful, but *
23 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
24 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
25 * for more details. *
26 * *
27 * You should have received a copy of the GNU General Public License along *
28 * with software; if not, write to the Free Software Foundation, Inc., *
29 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
30 * *
31 * CLooG, the Chunky Loop Generator *
32 * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr *
33 * *
34 ******************************************************************************/
37 #ifndef CLOOG_MATRIX_H
38 #define CLOOG_MATRIX_H
39 #if defined(__cplusplus)
40 extern "C"
42 #endif
45 /* The Matrix structure comes directly from PolyLib (defined in polylib/types.h)
46 * here is how it looks like (at least in PolyLib 5.20.0 version).
48 * typedef struct matrix {
49 * unsigned NbRows; // The number of rows (= NbConstraints in Polyhedron).
50 * unsigned NbColumns; // The number of columns (= Dimension+2 in Polyhedron).
51 * Value **p; // An array of pointers to the beginning of each row.
52 * Value *p_Init; // The matrix is stored here, contiguously in memory.
53 * int p_Init_size; // Needed to free the memory allocated by mpz_init.
54 * Matrix;
57 typedef Matrix CloogMatrix;
59 static inline Value
60 cloog_matrix_element (CloogMatrix *m, int row, int col)
62 return m->p[row][col];
65 static inline void
66 cloog_matrix_element_assign (CloogMatrix *m, int row, int col, Value val)
68 value_assign (m->p[row][col], val);
71 static inline void
72 cloog_matrix_element_increment (CloogMatrix *m, int row, int col, Value val)
74 value_increment (m->p[row][col], val);
77 static inline void
78 cloog_matrix_element_decrement (CloogMatrix *m, int row, int col, Value val)
80 value_decrement (m->p[row][col], val);
83 static inline void
84 cloog_matrix_element_substract (CloogMatrix *m, int row, int col, Value val1, Value val2)
86 value_substract (m->p[row][col], val1, val2);
89 static inline void
90 cloog_matrix_element_set_si (CloogMatrix *m, int row, int col, int val)
92 value_set_si (m->p[row][col], val);
95 /******************************************************************************
96 * PolyLib interface *
97 ******************************************************************************/
98 void cloog_matrix_print(FILE *, CloogMatrix *) ;
99 void cloog_matrix_free(CloogMatrix *) ;
100 CloogMatrix * cloog_matrix_alloc(unsigned, unsigned) ;
101 CloogMatrix * cloog_matrix_matrix(Matrix *);
104 /******************************************************************************
105 * Structure display function *
106 ******************************************************************************/
107 void cloog_matrix_print_structure(FILE *, CloogMatrix *, int) ;
109 /******************************************************************************
110 * Reading function *
111 ******************************************************************************/
112 CloogMatrix * cloog_matrix_read(FILE *) ;
114 /******************************************************************************
115 * Processing functions *
116 ******************************************************************************/
117 void cloog_matrix_normalize(CloogMatrix *, int) ;
118 void cloog_matrix_equality_update(CloogMatrix *, int, int) ;
119 CloogMatrix * cloog_matrix_copy(CloogMatrix *) ;
120 Value * cloog_matrix_vector_copy(Value *, int) ;
121 Value * cloog_matrix_vector_simplify(Value*, CloogMatrix*, int, int, int);
122 CloogMatrix * cloog_matrix_simplify(CloogMatrix *, CloogMatrix *, int, int) ;
123 void cloog_matrix_vector_free(Value *, int) ;
125 #if defined(__cplusplus)
127 #endif
128 #endif /* define _H */