OpenScop  0.9.0
Data Structures | Typedefs | Functions
vector.h File Reference
#include <stdio.h>
#include <osl/int.h>
Include dependency graph for vector.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  osl_vector

Typedefs

typedef struct osl_vector osl_vector_t
typedef struct osl_vectorosl_vector_p

Functions

void osl_vector_idump (FILE *, osl_vector_p, int)
void osl_vector_dump (FILE *, osl_vector_p)
osl_vector_p osl_vector_pmalloc (int, int)
osl_vector_p osl_vector_malloc (int)
void osl_vector_free (osl_vector_p)
osl_vector_p osl_vector_add_scalar (osl_vector_p, int)
osl_vector_p osl_vector_mul_scalar (osl_vector_p, int)
osl_vector_p osl_vector_add (osl_vector_p, osl_vector_p)
osl_vector_p osl_vector_sub (osl_vector_p, osl_vector_p)
void osl_vector_tag_inequality (osl_vector_p)
void osl_vector_tag_equality (osl_vector_p)
int osl_vector_equal (osl_vector_p, osl_vector_p)
int osl_vector_is_scalar (osl_vector_p)

Typedef Documentation

typedef struct osl_vector* osl_vector_p

Definition at line 90 of file vector.h.

typedef struct osl_vector osl_vector_t

Definition at line 89 of file vector.h.


Function Documentation

osl_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).

Parameters:
v1The first vector for the addition.
v2The second vector for the addition.
Returns:
A pointer to a new vector, corresponding to v1 + v2.

Definition at line 254 of file vector.c.

References OSL_error, osl_int_add(), osl_vector_pmalloc(), osl_vector::precision, osl_vector::size, and osl_vector::v.

osl_vector_p osl_vector_add_scalar ( osl_vector_p  vector,
int  scalar 
)

osl_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.

Parameters:
[in]vectorThe basis vector.
[in]scalarThe scalar to add to the vector.
Returns:
A pointer to a new vector, copy of the basis one plus the scalar.

Definition at line 226 of file vector.c.

References OSL_error, osl_int_add_si(), osl_int_assign(), osl_vector_pmalloc(), osl_vector::precision, osl_vector::size, and osl_vector::v.

void osl_vector_dump ( FILE *  file,
osl_vector_p  vector 
)

osl_vector_dump function: This function prints the content of a osl_vector_t structure (*vector) into a file (file, possibly stdout).

Parameters:
[in]fileFile where informations are printed.
[in]vectorThe vector whose information have to be printed.

Definition at line 138 of file vector.c.

References osl_vector_idump().

osl_vector_equal function: this function returns true if the two vectors are the same, false otherwise.

Parameters:
v1The first vector.
v2The second vector.
Returns:
1 if v1 and v2 are the same (content-wise), 0 otherwise.

Definition at line 333 of file vector.c.

References osl_int_ne(), osl_vector::precision, osl_vector::size, and osl_vector::v.

void osl_vector_free ( osl_vector_p  vector)

osl_vector_free function: This function frees the allocated memory for a osl_vector_t structure.

Parameters:
[in]vectorThe pointer to the vector we want to free.

Definition at line 197 of file vector.c.

References osl_int_clear(), osl_vector::precision, osl_vector::size, and osl_vector::v.

Referenced by osl_relation_insert_blank_row().

void osl_vector_idump ( FILE *  file,
osl_vector_p  vector,
int  level 
)

osl_vector_idump function: Displays a osl_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 idump functions.

Parameters:
[in]fileFile where informations are printed.
[in]vectorThe vector whose information have to be printed.
[in]levelNumber of spaces before printing, for each line.

Definition at line 89 of file vector.c.

References osl_int_dump_precision(), osl_int_print(), osl_vector::precision, osl_vector::size, and osl_vector::v.

Referenced by osl_vector_dump().

osl_vector_is_scalar function: this function returns 1 if the vector represents a scalar value (all but its last element is 0), 0 otherwise.

Parameters:
[in]vectorThe vector to check whether it is scalar or not.
Returns:
1 if the vector is scalar, 0 otherwise.

Definition at line 376 of file vector.c.

References osl_int_zero(), osl_vector::precision, osl_vector::size, and osl_vector::v.

osl_vector_malloc function: This function allocates the memory space for a osl_vector_t structure and sets its fields with default values. Then it returns a pointer to the allocated space. The precision of the vector elements corresponds to the precision environment variable or to the highest available precision if it is not defined.

Parameters:
[in]sizeThe number of entries of the vector to allocate.
Returns:
A pointer to the newly allocated osl_vector_t structure.

Definition at line 186 of file vector.c.

References osl_util_get_precision(), and osl_vector_pmalloc().

osl_vector_mul_scalar function: this function returns a new vector corresponding to the one provided as parameter with each entry multiplied by a scalar.

Parameters:
vThe vector to multiply.
scalarThe scalar coefficient.
Returns:
A new vector corresponding to scalar * v.

Definition at line 358 of file vector.c.

References osl_int_mul_si(), osl_vector_pmalloc(), osl_vector::precision, osl_vector::size, and osl_vector::v.

osl_vector_p osl_vector_pmalloc ( int  precision,
int  size 
)

osl_vector_pmalloc function: (precision malloc) this function allocates the memory space for an osl_vector_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.

Parameters:
[in]precisionThe precision of the vector entries.
[in]sizeThe number of entries of the vector to allocate.
Returns:
A pointer to the newly allocated osl_vector_t structure.

Definition at line 157 of file vector.c.

References osl_int_init_set_si(), OSL_malloc, osl_vector::precision, osl_vector::size, and osl_vector::v.

Referenced by osl_relation_insert_blank_row(), osl_vector_add(), osl_vector_add_scalar(), osl_vector_malloc(), osl_vector_mul_scalar(), and osl_vector_sub().

osl_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).

Parameters:
v1The first vector for the subtraction.
v2The second vector for the subtraction (result is v1-v2).
Returns:
A pointer to a new vector, corresponding to v1 - v2.

Definition at line 279 of file vector.c.

References OSL_error, osl_int_sub(), osl_vector_pmalloc(), osl_vector::precision, osl_vector::size, and osl_vector::v.

osl_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.

Parameters:
vectorThe vector to be tagged.

Definition at line 318 of file vector.c.

References OSL_error, osl_int_set_si(), osl_vector::precision, osl_vector::size, and osl_vector::v.

osl_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.

Parameters:
vectorThe vector to be tagged.

Definition at line 303 of file vector.c.

References OSL_error, osl_int_set_si(), osl_vector::precision, osl_vector::size, and osl_vector::v.