#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <scoplib/matrix.h>
void scoplib_matrix_add_vector | ( | scoplib_matrix_p | matrix, | |
scoplib_vector_p | vector, | |||
int | row | |||
) |
scoplib_matrix_add_vector function: this function adds the "row"^th row of a matrix "matrix" with the vector "vector". It directly updates "matrix".
matrix | The matrix we want to change a row. | |
vector | The vector that will replace a row of the matrix. | |
row | The row of the matrix to be replaced. |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_vector::p, scoplib_matrix::p, SCOPVAL_addto, SCOPVAL_assign, SCOPVAL_get_si, and scoplib_vector::Size.
scoplib_matrix_p scoplib_matrix_concat | ( | scoplib_matrix_p | m1, | |
scoplib_matrix_p | m2 | |||
) |
scoplib_matrix_concat function: this function builds a new matrix as the concatenation of the rows of two other matrices sent as parameters.
m1 | The first matrix. | |
m2 | The second matrix. |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_matrix_copy(), scoplib_matrix_malloc(), and scoplib_matrix_replace_matrix().
scoplib_matrix_p scoplib_matrix_copy | ( | scoplib_matrix_p | matrix | ) |
scoplib_matrix_copy function: this functions builds and returns a "hard copy" (not a pointer copy) of a scoplib_matrix_t data structure.
matrix | The pointer to the matrix we want to copy. |
References scoplib_matrix::NbRows, and scoplib_matrix_ncopy().
Referenced by scoplib_matrix_concat(), and scoplib_scop_dup().
int scoplib_matrix_equal | ( | scoplib_matrix_p | m1, | |
scoplib_matrix_p | m2 | |||
) |
scoplib_matrix_equal function: this function returns true if the two matrices are the same, false otherwise.
m1 | The first matrix. | |
m2 | The second matrix. |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_matrix::p, and SCOPVAL_ne.
static char* scoplib_matrix_expression | ( | scoplib_matrix_p | matrix, | |
int | row, | |||
int | nb_iterators, | |||
char ** | iterators, | |||
int | nb_parameters, | |||
char ** | parameters | |||
) | [static] |
scoplib_matrix_expression function: This function returns a string corresponding to an affine expression stored at the "row"^th row of the matrix pointed by "matrix".
matrix | A set of linear expressions. | |
row | The row of the matrix corresponding to the expression. | |
nb_iterators | The number of iterators for the considered statement. | |
iterators | An array containing iterator names for the statement. | |
nb_parameters | The number of parameters in the SCoP. | |
parameters | An array containing all parameters names. |
References scoplib_matrix::p, scoplib_matrix_expression_element(), and SCOPLIB_MAX_STRING.
Referenced by scoplib_matrix_print_dot_scop().
static char* scoplib_matrix_expression_element | ( | scoplib_int_t | val, | |
int * | first, | |||
int | cst, | |||
char * | name | |||
) | [static] |
scoplib_matrix_expression_element function: This function returns a string containing the printing of a value (possibly an iterator or a parameter with its coefficient or a constant).
val | The coefficient or constant value. | |
first | Pointer to a boolean set to 1 if the current value is the first of an expresion, 0 otherwise (this function may update it). | |
cst | A boolean set to 1 if the value is a constant, 0 otherwise. | |
name | String containing the name of the iterator or of the parameter. |
References SCOPLIB_MAX_STRING, SCOPVAL_mone_p, SCOPVAL_neg_p, SCOPVAL_notzero_p, SCOPVAL_one_p, SCOPVAL_pos_p, SCOPVAL_sprint, and SCOPVAL_zero_p.
Referenced by scoplib_matrix_expression().
void scoplib_matrix_free | ( | scoplib_matrix_p | matrix | ) |
scoplib_matrix_free function: This function frees the allocated memory for a scoplib_matrix_t structure.
matrix | The pointer to the matrix we want to free. |
References scoplib_matrix_free_inside().
Referenced by scoplib_matrix_list_free(), scoplib_scop_free(), and scoplib_statement_free().
void scoplib_matrix_free_inside | ( | scoplib_matrix_p | matrix | ) |
scoplib_matrix_free_inside function: This function frees the allocated memory for the inside of a scoplib_matrix_t structure, i.e. only p and p_Init.
matrix | The pointer to the matrix we want to free. |
References scoplib_matrix::p, scoplib_matrix::p_Init, scoplib_matrix::p_Init_size, and SCOPVAL_clear.
Referenced by scoplib_matrix_free(), scoplib_matrix_insert_matrix(), and scoplib_matrix_insert_vector().
scoplib_matrix_p scoplib_matrix_from_vector | ( | scoplib_vector_p | vector | ) |
scoplib_matrix_from_vector function: this function converts a vector "vector" to a matrix with a single row and returns a pointer to that matrix.
vector | The vector to convert to a matrix. |
References scoplib_matrix_malloc(), scoplib_matrix_replace_vector(), and scoplib_vector::Size.
void scoplib_matrix_insert_matrix | ( | scoplib_matrix_p | m1, | |
scoplib_matrix_p | m2, | |||
int | row | |||
) |
scoplib_matrix_insert_matrix function: this function adds new rows corresponding to the matrix "m1" to the matrix "m2" by inserting it at the "row"^th row. It directly updates "m1". If "m2" (or "m1") is NULL, the matrix is left unmodified.
m1 | The matrix we want to extend. | |
m2 | The matrix to be inserted. | |
row | The row where to insert the matrix |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_matrix::p, scoplib_matrix::p_Init, scoplib_matrix_free_inside(), scoplib_matrix_malloc(), scoplib_matrix_replace_matrix(), and SCOPVAL_assign.
void scoplib_matrix_insert_vector | ( | scoplib_matrix_p | matrix, | |
scoplib_vector_p | vector, | |||
int | row | |||
) |
scoplib_matrix_insert_vector function: this function adds a new row corresponding to the vector "vector" to the matrix "matrix" by inserting it at the "row"^th row. It directly updates "matrix". If "vector" (or "matrix") is NULL, the matrix is left unmodified.
matrix | The matrix we want to extend. | |
vector | The vector that will be added matrix. | |
row | The row where to insert the vector. |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_matrix::p, scoplib_matrix::p_Init, scoplib_matrix_free_inside(), scoplib_matrix_malloc(), scoplib_matrix_replace_vector(), SCOPVAL_assign, and scoplib_vector::Size.
void scoplib_matrix_list_free | ( | scoplib_matrix_list_p | list | ) |
scoplib_matrix_list_free function: This function frees the allocated memory for a scoplib_matrix_list_t structure, and all the matrices stored in the list.
list | The pointer to the matrix list we want to free. |
References scoplib_matrix_list::elt, scoplib_matrix_list::next, and scoplib_matrix_free().
Referenced by scoplib_statement_free().
scoplib_matrix_list_p scoplib_matrix_list_malloc | ( | ) |
scoplib_matrix_list_malloc function: This function allocates the memory space for a scoplib_matrix_list_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.
References scoplib_matrix_list::elt, and scoplib_matrix_list::next.
Referenced by scoplib_matrix_list_read(), and scoplib_scop_dup().
void scoplib_matrix_list_print | ( | FILE * | file, | |
scoplib_matrix_list_p | list | |||
) |
scoplib_matrix_list_print function: This function prints the content of a scoplib_matrix_list_t into a file (file, possibly stdout).
file | File where informations are printed. | |
list | The matrix whose information have to be printed. |
References scoplib_matrix_list_print_structure().
void scoplib_matrix_list_print_dot_scop | ( | FILE * | file, | |
scoplib_matrix_list_p | list, | |||
int | type, | |||
int | nb_iterators, | |||
char ** | iterators, | |||
int | nb_parameters, | |||
char ** | parameters, | |||
int | nb_arrays, | |||
char ** | arrays | |||
) |
scoplib_matrix_list_print_dot_scop function: This function prints the content of a scoplib_matrix_list_t structure into a file (file, possibly stdout) for the .scop format.
file | File where informations are printed. | |
list | The matrix list whose information have to be printed. | |
type | A bit of semantic about this matrix (domain, access...). | |
nb_iterators | The number of iterators for the considered statement. | |
iterators | An array containing iterator names for the statement. | |
nb_parameters | The number of parameters in the SCoP. | |
parameters | An array containing all parameters names. | |
nb_arrays | The number of arrays accessed in the SCoP. | |
arrays | An array containing all accessed array names. |
References scoplib_matrix_list::elt, scoplib_matrix_list::next, and scoplib_matrix_print_dot_scop().
Referenced by scoplib_statement_print_dot_scop().
void scoplib_matrix_list_print_structure | ( | FILE * | file, | |
scoplib_matrix_list_p | l, | |||
int | level | |||
) |
scoplib_matrix_list_print_structure function: Displays a scoplib_matrix_list_t structure (a list of matrices) into a file (file, possibly stdout). See scoplib_matrix_print_structure for more details.
file | File where informations are printed. | |
l | The list of matrices whose information have to be printed. | |
level | Number of spaces before printing, for each line. |
References scoplib_matrix_list::elt, scoplib_matrix_list::next, and scoplib_matrix_print_structure().
Referenced by scoplib_matrix_list_print(), and scoplib_statement_print_structure().
scoplib_matrix_list_p scoplib_matrix_list_read | ( | FILE * | file | ) |
scoplib_matrix_list_read function: This function reads a list of matrices into a file (foo, posibly stdin) and returns a pointer this matrix list.
file | File where informations are stored. |
References scoplib_matrix_list::elt, scoplib_matrix_list::next, scoplib_matrix_list_malloc(), scoplib_matrix_read(), and SCOPLIB_MAX_STRING.
Referenced by scoplib_statement_read().
scoplib_matrix_p scoplib_matrix_malloc | ( | unsigned | NbRows, | |
unsigned | NbColumns | |||
) |
scoplib_matrix_malloc function: This function allocates the memory space for a scoplib_matrix_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.
NbRows | The number of row of the matrix to allocate. | |
NbColumns | The number of columns of the matrix to allocate. |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_matrix::p, scoplib_matrix::p_Init, scoplib_matrix::p_Init_size, and SCOPVAL_init_set_si.
Referenced by scoplib_matrix_concat(), scoplib_matrix_from_vector(), scoplib_matrix_insert_matrix(), scoplib_matrix_insert_vector(), scoplib_matrix_ncopy(), scoplib_matrix_read(), and scoplib_matrix_read_arrays().
scoplib_matrix_p scoplib_matrix_ncopy | ( | scoplib_matrix_p | matrix, | |
int | n | |||
) |
scoplib_matrix_ncopy function: this functions builds and returns a "hard copy" (not a pointer copy) of a scoplib_matrix_t data structure such that the copy is restricted to the "n" first rows of the matrix.
matrix | The pointer to the matrix we want to copy. | |
n | The number of row of the matrix we want to copy. |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_matrix::p, scoplib_matrix_malloc(), and SCOPVAL_assign.
Referenced by scoplib_matrix_copy().
void scoplib_matrix_print | ( | FILE * | file, | |
scoplib_matrix_p | matrix | |||
) |
scoplib_matrix_print function: This function prints the content of a scoplib_matrix_t structure (*matrix) into a file (file, possibly stdout).
file | File where informations are printed. | |
matrix | The matrix whose information have to be printed. |
References scoplib_matrix_print_structure().
void scoplib_matrix_print_dot_scop | ( | FILE * | file, | |
scoplib_matrix_p | matrix, | |||
int | type, | |||
int | nb_iterators, | |||
char ** | iterators, | |||
int | nb_parameters, | |||
char ** | parameters, | |||
int | nb_arrays, | |||
char ** | arrays | |||
) |
scoplib_matrix_print_dot_scop function: This function prints the content of a scoplib_matrix_t structure (*matrix) into a file (file, possibly stdout) for the .scop format.
file | File where informations are printed. | |
matrix | The matrix whose information have to be printed. | |
type | A bit of semantic about this matrix (domain, access...). | |
nb_iterators | The number of iterators for the considered statement. | |
iterators | An array containing iterator names for the statement. | |
nb_parameters | The number of parameters in the SCoP. | |
parameters | An array containing all parameters names. | |
nb_arrays | The number of arrays accessed in the SCoP. | |
arrays | An array containing all accessed array names. |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_matrix::p, SCOPLIB_FAKE_ARRAY, scoplib_matrix_expression(), SCOPLIB_TYPE_ACCESS, SCOPLIB_TYPE_DOMAIN, SCOPLIB_TYPE_SCATTERING, SCOPVAL_get_si, SCOPVAL_notzero_p, SCOPVAL_print, and SCOPVAL_zero_p.
Referenced by scoplib_matrix_list_print_dot_scop(), scoplib_scop_print_dot_scop_(), and scoplib_statement_print_dot_scop().
void scoplib_matrix_print_structure | ( | FILE * | file, | |
scoplib_matrix_p | matrix, | |||
int | level | |||
) |
scoplib_matrix_print_structure function: Displays a scoplib_matrix_t structure (*matrix) into a file (file, possibly stdout) in a way that trends to be understandable without falling in a deep depression or, for the lucky ones, getting a headache... It includes an indentation level (level) in order to work with others print_structure functions.
file | File where informations are printed. | |
matrix | The matrix whose information have to be printed. | |
level | Number of spaces before printing, for each line. |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_matrix::p, and SCOPVAL_print.
Referenced by scoplib_matrix_list_print_structure(), scoplib_matrix_print(), scoplib_scop_print_structure(), and scoplib_statement_print_structure().
scoplib_matrix_p scoplib_matrix_read | ( | FILE * | foo | ) |
scoplib_matrix_read function: Adaptation from the PolyLib. This function reads a matrix into a file (foo, posibly stdin) and returns a pointer this matrix. October 18th 2001: first version.
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_matrix::p_Init, scoplib_matrix_malloc(), and SCOPLIB_MAX_STRING.
Referenced by scoplib_matrix_list_read(), scoplib_scop_read(), and scoplib_statement_read().
scoplib_matrix_p scoplib_matrix_read_arrays | ( | FILE * | foo, | |
char *** | arrays, | |||
int * | nb_arr | |||
) |
scoplib_matrix_read_arrays function: This function reads a matrix into a file (foo, posibly stdin) and returns a pointer this matrix. In addition, it reads the arrays as comments at the end of the line.
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_matrix::p, scoplib_matrix::p_Init, scoplib_matrix_malloc(), SCOPLIB_MAX_STRING, and SCOPVAL_get_si.
Referenced by scoplib_statement_read().
void scoplib_matrix_replace_matrix | ( | scoplib_matrix_p | m1, | |
scoplib_matrix_p | m2, | |||
int | row | |||
) |
scoplib_matrix_replace_matrix function: this function replaces some rows of a matrix "m1" with the rows of the matrix "m2". It begins at the "row"^th row of "m1". It directly updates "m1".
m1 | The matrix we want to change some row1. | |
m2 | The matrix containing the new rows. | |
row | The first row of the matrix m1 to be replaced. |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_matrix::p, and SCOPVAL_assign.
Referenced by scoplib_matrix_concat(), and scoplib_matrix_insert_matrix().
void scoplib_matrix_replace_vector | ( | scoplib_matrix_p | matrix, | |
scoplib_vector_p | vector, | |||
int | row | |||
) |
scoplib_matrix_replace_vector function: this function replaces the "row"^th row of a matrix "matrix" with the vector "vector". It directly updates "matrix".
matrix | The matrix we want to change a row. | |
vector | The vector that will replace a row of the matrix. | |
row | The row of the matrix to be replaced. |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_vector::p, scoplib_matrix::p, SCOPVAL_assign, and scoplib_vector::Size.
Referenced by scoplib_matrix_from_vector(), and scoplib_matrix_insert_vector().
void scoplib_matrix_sub_vector | ( | scoplib_matrix_p | matrix, | |
scoplib_vector_p | vector, | |||
int | row | |||
) |
scoplib_matrix_sub_vector function: this function substracts the vector "vector" to the "row"^th row of a matrix "matrix. It directly updates "matrix".
matrix | The matrix we want to change a row. | |
vector | The vector that will replace a row of the matrix. | |
row | The row of the matrix to be replaced. |
References scoplib_matrix::NbColumns, scoplib_matrix::NbRows, scoplib_vector::p, scoplib_matrix::p, SCOPVAL_assign, SCOPVAL_get_si, SCOPVAL_subtract, and scoplib_vector::Size.