ScopLib
0.2.1
|
00001 00002 /*+------- <| --------------------------------------------------------** 00003 ** A Clan/Scop ** 00004 **--- /.\ -----------------------------------------------------** 00005 ** <| [""M# matrix.h ** 00006 **- A | # -----------------------------------------------------** 00007 ** /.\ [""M# First version: 30/04/2008 ** 00008 **- [""M# | # U"U#U -----------------------------------------------** 00009 | # | # \ .:/ 00010 | # | #___| # 00011 ****** | "--' .-" ****************************************************** 00012 * |"-"-"-"-"-#-#-## Clan : the Chunky Loop Analyzer (experimental) * 00013 **** | # ## ###### ***************************************************** 00014 * \ .::::'/ * 00015 * \ ::::'/ Copyright (C) 2008 Cedric Bastoul * 00016 * :8a| # # ## * 00017 * ::88a ### This is free software; you can redistribute it * 00018 * ::::888a 8a ##::. and/or modify it under the terms of the GNU Lesser * 00019 * ::::::::888a88a[]::: General Public License as published by the Free * 00020 *::8:::::::::SUNDOGa8a::. Software Foundation, either version 2.1 of the * 00021 *::::::::8::::888:Y8888:: License, or (at your option) any later version. * 00022 *::::':::88::::888::Y88a::::::::::::... * 00023 *::'::.. . ..... .. ... . * 00024 * This software is distributed in the hope that it will be useful, but * 00025 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 00026 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * 00027 * for more details. * 00028 * * 00029 * You should have received a copy of the GNU Lesser General Public License * 00030 * along with software; if not, write to the Free Software Foundation, Inc., * 00031 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 00032 * * 00033 * Clan, the Chunky Loop Analyzer * 00034 * Written by Cedric Bastoul, Cedric.Bastoul@inria.fr * 00035 * * 00036 ******************************************************************************/ 00037 00038 00039 #ifndef SCOPLIB_MATRIX_H 00040 # define SCOPLIB_MATRIX_H 00041 00042 # include <stdio.h> 00043 # include <scoplib/macros.h> 00044 # include <scoplib/vector.h> 00045 00046 00047 # if defined(__cplusplus) 00048 extern "C" 00049 { 00050 # endif 00051 00052 00062 struct scoplib_matrix 00063 { 00064 unsigned NbRows; 00065 unsigned NbColumns; 00066 scoplib_int_t ** p; 00068 scoplib_int_t * p_Init; 00070 int p_Init_size; 00072 }; 00073 typedef struct scoplib_matrix scoplib_matrix_t; 00074 typedef struct scoplib_matrix * scoplib_matrix_p; 00075 00076 00084 struct scoplib_matrix_list 00085 { 00086 scoplib_matrix_p elt; 00087 struct scoplib_matrix_list* next; 00089 }; 00090 typedef struct scoplib_matrix_list scoplib_matrix_list_t; 00091 typedef struct scoplib_matrix_list * scoplib_matrix_list_p; 00092 00093 00094 /*+**************************************************************************** 00095 * Structure display function * 00096 ******************************************************************************/ 00097 void scoplib_matrix_print_structure(FILE *, scoplib_matrix_p, int); 00098 void scoplib_matrix_print(FILE *, scoplib_matrix_p); 00099 void scoplib_matrix_print_dot_scop(FILE *, scoplib_matrix_p, int, 00100 int, char **, int, char **, 00101 int, char **); 00102 00103 void scoplib_matrix_list_print_structure(FILE *, 00104 scoplib_matrix_list_p, int); 00105 void scoplib_matrix_list_print(FILE *, scoplib_matrix_list_p); 00106 void scoplib_matrix_list_print_dot_scop(FILE *, scoplib_matrix_list_p, 00107 int, int, char **, int, 00108 char **, int, char **); 00109 00110 00111 /****************************************************************************** 00112 * Reading function * 00113 ******************************************************************************/ 00114 scoplib_matrix_p scoplib_matrix_read(FILE *); 00115 scoplib_matrix_list_p scoplib_matrix_list_read(FILE *); 00116 scoplib_matrix_p scoplib_matrix_read_arrays(FILE *, char ***, int *); 00117 00118 00119 /*+**************************************************************************** 00120 * Memory allocation/deallocation function * 00121 ******************************************************************************/ 00122 scoplib_matrix_p scoplib_matrix_malloc(unsigned, unsigned); 00123 void scoplib_matrix_free_inside(scoplib_matrix_p); 00124 void scoplib_matrix_free(scoplib_matrix_p); 00125 00126 scoplib_matrix_list_p scoplib_matrix_list_malloc(); 00127 void scoplib_matrix_list_free(scoplib_matrix_list_p); 00128 00129 00130 /*+**************************************************************************** 00131 * Processing functions * 00132 ******************************************************************************/ 00133 scoplib_matrix_p scoplib_matrix_ncopy(scoplib_matrix_p, int); 00134 scoplib_matrix_p scoplib_matrix_copy(scoplib_matrix_p); 00135 void scoplib_matrix_replace_vector(scoplib_matrix_p, scoplib_vector_p, int); 00136 void scoplib_matrix_insert_vector(scoplib_matrix_p, scoplib_vector_p, int); 00137 void scoplib_matrix_add_vector(scoplib_matrix_p, scoplib_vector_p, int); 00138 void scoplib_matrix_sub_vector(scoplib_matrix_p, scoplib_vector_p, int); 00139 scoplib_matrix_p scoplib_matrix_from_vector(scoplib_vector_p); 00140 void scoplib_matrix_replace_matrix(scoplib_matrix_p, scoplib_matrix_p, int); 00141 void scoplib_matrix_insert_matrix(scoplib_matrix_p, scoplib_matrix_p, int); 00142 scoplib_matrix_p scoplib_matrix_concat(scoplib_matrix_p, scoplib_matrix_p); 00143 int scoplib_matrix_equal(scoplib_matrix_p, scoplib_matrix_p); 00144 00145 # if defined(__cplusplus) 00146 } 00147 # endif 00148 #endif /* define SCOPLIB_MATRIX_H */