#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <scoplib/vector.h>
Functions | |
void | scoplib_vector_print_structure (FILE *file, scoplib_vector_p vector, int level) |
void | scoplib_vector_print (FILE *file, scoplib_vector_p vector) |
scoplib_vector_p | scoplib_vector_malloc (unsigned Size) |
void | scoplib_vector_free (scoplib_vector_p vector) |
scoplib_vector_p | scoplib_vector_add_scalar (scoplib_vector_p vector, int scalar) |
scoplib_vector_p | scoplib_vector_add (scoplib_vector_p v1, scoplib_vector_p v2) |
scoplib_vector_p | scoplib_vector_sub (scoplib_vector_p v1, scoplib_vector_p v2) |
void | scoplib_vector_tag_inequality (scoplib_vector_p vector) |
void | scoplib_vector_tag_equality (scoplib_vector_p vector) |
scoplib_vector_p scoplib_vector_add | ( | scoplib_vector_p | v1, | |
scoplib_vector_p | v2 | |||
) |
scoplib_vector_add function: This function achieves the addition of two vectors and returns the result as a new vector (the addition means the ith entry of the new vector is equal to the ith entry of vector v1 plus the ith entry of vector v2).
v1 | The first vector for the addition. | |
v2 | The second vector for the addition (result is v1+v2). |
References scoplib_vector::p, scoplib_vector_malloc(), SCOPVAL_addto, and scoplib_vector::Size.
scoplib_vector_p scoplib_vector_add_scalar | ( | scoplib_vector_p | vector, | |
int | scalar | |||
) |
scoplib_vector_add_scalar function: This function adds a scalar to the vector representation of an affine expression (this means we add the scalar only to the very last entry of the vector). It returns a new vector resulting from this addition.
vector | The basis vector. | |
scalar | The scalar to add to the vector. |
References scoplib_vector::p, scoplib_vector_malloc(), SCOPVAL_add_int, SCOPVAL_assign, and scoplib_vector::Size.
void scoplib_vector_free | ( | scoplib_vector_p | vector | ) |
scoplib_vector_free function: This function frees the allocated memory for a scoplib_vector_t structure.
vector | The pointer to the vector we want to free. |
References scoplib_vector::p, SCOPVAL_clear, and scoplib_vector::Size.
scoplib_vector_p scoplib_vector_malloc | ( | unsigned | Size | ) |
scoplib_vector_malloc function: This function allocates the memory space for a scoplib_vector_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.
Size | The number of entries of the vector to allocate. |
References scoplib_vector::p, SCOPVAL_init_set_si, and scoplib_vector::Size.
Referenced by scoplib_vector_add(), scoplib_vector_add_scalar(), and scoplib_vector_sub().
void scoplib_vector_print | ( | FILE * | file, | |
scoplib_vector_p | vector | |||
) |
scoplib_vector_print function: This function prints the content of a scoplib_vector_t structure (*vector) into a file (file, possibly stdout).
file | File where informations are printed. | |
vector | The vector whose information have to be printed. |
References scoplib_vector_print_structure().
void scoplib_vector_print_structure | ( | FILE * | file, | |
scoplib_vector_p | vector, | |||
int | level | |||
) |
scoplib_vector_print_structure function: Displays a scoplib_vector_t structure (*vector) 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. | |
vector | The vector whose information have to be printed. | |
level | Number of spaces before printing, for each line. |
References scoplib_vector::p, SCOPVAL_print, and scoplib_vector::Size.
Referenced by scoplib_vector_print().
scoplib_vector_p scoplib_vector_sub | ( | scoplib_vector_p | v1, | |
scoplib_vector_p | v2 | |||
) |
scoplib_vector_sub function: This function achieves the subtraction of two vectors and returns the result as a new vector (the addition means the ith entry of the new vector is equal to the ith entry of vector v1 minus the ith entry of vector v2).
v1 | The first vector for the subtraction. | |
v2 | The second vector for the subtraction (result is v1-v2). |
References scoplib_vector::p, scoplib_vector_malloc(), SCOPVAL_subtract, and scoplib_vector::Size.
void scoplib_vector_tag_equality | ( | scoplib_vector_p | vector | ) |
scoplib_vector_tag_equality function: This function tags a vector representation of a contraint as being an equality ==0. This means in the PolyLib format, to set to 0 the very first entry of the vector. It modifies directly the vector provided as an argument.
vector | The vector to be tagged. |
References scoplib_vector::p, SCOPVAL_set_si, and scoplib_vector::Size.
void scoplib_vector_tag_inequality | ( | scoplib_vector_p | vector | ) |
scoplib_vector_tag_inequality function: This function tags a vector representation of a contraint as being an inequality >=0. This means in the PolyLib format, to set to 1 the very first entry of the vector. It modifies directly the vector provided as an argument.
vector | The vector to be tagged. |
References scoplib_vector::p, SCOPVAL_set_si, and scoplib_vector::Size.