2 /**-------------------------------------------------------------------**
4 **-------------------------------------------------------------------**
6 **-------------------------------------------------------------------**
7 ** First version: april 17th 2005 **
8 **-------------------------------------------------------------------**/
11 /******************************************************************************
12 * CLooG : the Chunky Loop Generator (experimental) *
13 ******************************************************************************
15 * Copyright (C) 2005 Cedric Bastoul *
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 *
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 *
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 *
31 * CLooG, the Chunky Loop Generator *
32 * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr *
34 ******************************************************************************/
37 #ifndef CLOOG_MATRIX_H
38 #define CLOOG_MATRIX_H
39 #if defined(__cplusplus)
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.
57 typedef Matrix CloogMatrix
;
60 cloog_matrix_element (CloogMatrix
*m
, int row
, int col
)
62 return m
->p
[row
][col
];
66 cloog_matrix_element_assign (CloogMatrix
*m
, int row
, int col
, Value val
)
68 value_assign (m
->p
[row
][col
], val
);
72 cloog_matrix_element_increment (CloogMatrix
*m
, int row
, int col
, Value val
)
74 value_increment (m
->p
[row
][col
], val
);
78 cloog_matrix_element_decrement (CloogMatrix
*m
, int row
, int col
, Value val
)
80 value_decrement (m
->p
[row
][col
], val
);
84 cloog_matrix_element_substract (CloogMatrix
*m
, int row
, int col
, Value val1
, Value val2
)
86 value_substract (m
->p
[row
][col
], val1
, val2
);
90 cloog_matrix_element_set_si (CloogMatrix
*m
, int row
, int col
, int val
)
92 value_set_si (m
->p
[row
][col
], val
);
95 /******************************************************************************
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 /******************************************************************************
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)
128 #endif /* define _H */