[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Environements (`ap_environment.h')

Environments bind variables (of level 1) to dimensions (of level 0).

datatype: ap_environment_t
Internal datatype for environments.

For information, the definition is:
 
typedef struct ap_environment_t {
  ap_var_t* var_of_dim;
  /*
    Array of size intdim+realdim, indexed by dimensions.
    - It should not contain identical strings..
    - Slice [0..intdim-1] is lexicographically sorted,
      and denotes integer variables.
    - Slice [intdim..intdim+realdim-1] is lexicographically sorted,
      and denotes real variables.
    - The memory allocated for the variables are attached to the structure
      (they are freed when the structure is no longer in use)
  */
  size_t intdim; /* Number of integer variables */
  size_t realdim;/* Number of real variables */
  size_t count; /* For reference counting */
} ap_environment_t;

Function: void ap_environment_free (ap_environment_t* env)
Function: ap_environment_t* ap_environment_copy (ap_environment_t* env)
Respectively free and duplicate an environment.

(copy is cheap, as environments are managed with reference counters).

Function: void ap_environment_fdump (FILE* stream, ap_environment_t* env)
Print an environement under the form:
 
  environment: dim = (..,..), count = ..
  0: name0
  1: name1
  ...

Function: ap_environment_t* ap_environment_alloc_empty ()
Build an empty environement.

Function: ap_environment_t* ap_environment_alloc (ap_var_t* var_of_intdim, size_t intdim, ap_var_t* var_of_realdim, size_t realdim)
Build an environement from an array of integer and an array of real variables.

var_of_intdim is an array of variables of size intdim, var_of_realdim is an array of variables of size realdim. Pointers to arrays may be NULL if their size is 0.

Variables are duplicated in the result, so it is the responsability of the user to free the variables he provides.

If some variables are duplicated, return NULL.

Function: ap_environment_t* ap_environment_add (const ap_environment_t* env, ap_var_t* var_of_intdim, size_t intdim, ap_var_t* var_of_realdim, size_t realdim)
Function: ap_environment_t* ap_environment_remove (const ap_environment_t* env, ap_var_t* var_of_intdim, size_t intdim, ap_var_t* var_of_realdim, size_t realdim)
Resp. add or remove new variables to an existing environement, with a functional semantics. Same conventions as for ap_environment_alloc function apply. If the result is non-sense, return NULL.

Function: ap_dim_t ap_environment_dim_of_var (const ap_environment_t* env, ap_var_t var)
Convert a variable in its corresponding dimension in the environement env. If var is unknown in env, return AP_DIM_MAX.
Function: ap_dim_t ap_environment_var_of_dim (const ap_environment_t* env, ap_dim_t dim)
Return the variable associated to the dimension dim in the environement env. There is no bound check here.

The remaining functions are much less useful for normal user.

Function: bool ap_environment_is_eq (const ap_environment_t* env1, const ap_environment_t* env2)
Function: bool ap_environment_is_leq (const ap_environment_t* env1, const ap_environment_t* env2)
Resp. test the equality and the inclusion of two environements.
Function: int ap_environment_compare (const ap_environment_t* env1, const ap_environment_t* env2)
Return:
-2
if the environements are not compatible (a variable has a different type in the 2 environements);
-1
if env1 is a subset of (included in) env2;
0
if they are equal;
+1
if env1 is a superset of env2;
+2
otherwise: the least common environement exists and is a strict superset of both environements.

Function: ap_dimchange_t* ap_environment_dimchange (const ap_environment_t* env1, const ap_environment_t* env)
Compute the transformation for converting from an environment env1 to a superenvironment env. Return NULL if env is not a superenvironment.

Function: ap_environment_t* ap_environment_lce (const ap_environment_t* env1, const ap_environment_t* env2, ap_dimchange_t** dimchange1, ap_dimchange_t** dimchange2)
Least common environement to two enviroenments.

Function: ap_environment_t* ap_environment_lce_array (const ap_environment_t** tenv, size_t size, ap_dimchange_t*** ptdimchange)
Least common environement to an array of environements.

Function: ap_environment_t* ap_environment_rename (ap_environment_t* env, ap_var_t* tvar1, ap_var_t* tvar2, size_t size, ap_dimperm_t* perm)
Rename the variables in the environement. size is the common size of arrays tvar1 and tvar2, and perm is a result-parameter pointing to an existing but not initialized object of type ap_dimperm_t.

The function applies the variable substitution tvar1[i]->tvar2[i] to the environement, and returns the resulting environement and the allocated transformation permutation in *perm.

If the parameters are not valid, return NULL with perm->dim==NULL.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on December, 22 2006 using texi2html