Next: , Previous: , Up: Level 1 of the interface  

generators of level 1 (ap_generator1.h)

datatype: ap_generator1_t

Datatype for generators.

For information:

typedef struct ap_generator1_t {
  ap_generator0_t generator0;
  ap_environment_t* env;
} ap_generator1_t;

Generators are meant to be manipulated freely via their components. Creating the ray generator x+2/3y and then freeing it can be done with

ap_generator1_t gen = ap_generator1_make(AP_GEN_RAY,
				      ap_linexpr1_alloc(env,AP_LINEXPR_SPARSE,2));
ap_generator1_set_list(&gen,
		     AP_COEFF_S_INT, 1, "x",
		     AP_COEFF_S_FRAC, 2,3, "y",
		     AP_END);
ap_generator1_clear(&gen);
datatype: ap_generator1_array_t
typedef struct ap_generator1_array_t {
  ap_generator0_array_t generator0_array;
  ap_environment_t* env;
} ap_generator1_array_t;

Datatype for arrays of generators.

Arrays at level 1 cannot be accessed directly, for example by writing array->p[i], but should instead be accessed with functions ap_generator1_array_get and ap_generator1_array_set.


Next: , Previous: , Up: Generators of level 1  

Allocating generators of level 1

Function: ap_generator1_t ap_generator1_make (ap_gentyp_t gentyp, ap_linexpr1_t* linexpr)

Create a generator of type gentyp with the expression linexpr.

The expression is not duplicated, just pointed to, so it becomes managed via the generator.

Function: ap_generator1_t ap_generator1_copy (ap_generator1_t* gen)

Duplication

Function: void ap_generator1_clear (ap_generator1_t* gen)

Clear the generator and set pointers to NULL.

Function: void ap_generator1_fprint (FILE* stream, ap_generator1_t* gen);

Print the linear generator on stream stream.


Next: , Previous: , Up: Generators of level 1  

Access to generators of level 1

Function: ap_environment_t* ap_generator1_envref (ap_generator1_t* gen)

Get a reference to the environment. Do not free it.

Function: ap_gentyp_t* ap_generator1_gentypref (ap_generator1_t* gen)

Get a reference to the type of generator. You may use the reference to modify the generator type.

Function: ap_linexpr1_t ap_generator1_linexpr1ref (ap_generator1_t* gen)

Get a reference to the underlying expression of the generator. Do not free it: nothing is duplicated. Modifying the argument or the result is equivalent, except for change of dimensions/environment.

Function: void ap_generator1_get_cst (ap_coeff_t* coeff, ap_generator1_t* gen)
Function: void ap_generator1_set_cst (ap_generator1_t* gen, ap_coeff_t* cst)
Function: bool ap_generator1_get_coeff (ap_coeff_t* coeff, ap_generator1_t* gen, ap_var_t var)
Function: bool ap_generator1_set_coeff (ap_generator1_t* gen, ap_var_t var, ap_coeff_t* coeff)
Function: bool ap_generator1_set_list (ap_generator1_t* gen, ...)
Function: ap_coeff_t* ap_generator1_cstref (ap_generator1_t* gen)
Function: ap_coeff_t* ap_generator1_coeffref (ap_generator1_t* gen, ap_var_t var)

Identical to corresponding ap_linexpr1_XXX functions (see Access to linear expressions of level 1).

Function: ap_generator0_t* ap_generator1_generator0ref (ap_generator1_t* gen)

Return underlying generator of level 0. Do not free it: nothing is duplicated. Modifying the argument or the result is equivalent, except for change of dimensions/envionment.


Next: , Previous: , Up: Generators of level 1  

Change of dimensions and permutations of generators of level 1

Function: bool ap_generator1_extend_environment (ap_generator1_t* ngen, ap_generator1_t* gen, ap_environment_t* nenv)
Function: bool ap_generator1_extend_environment_with (ap_generator1_t* gen, ap_environment_t* nenv)

Identical to corresponding ap_linexpr1_XXX functions (see Change of dimensions and permutations of linear expressions of level 1).


Previous: , Up: Generators of level 1  

Arrays of generators of level 1

Function: ap_generator1_array_t ap_generator1_array_make (ap_environment_t* env, size_t size)

Allocate an array of generators of size size, defined on the environment env.

The generators are initialized with NULL pointers for underlying expressions.

Function: void ap_generator1_array_clear (ap_generator1_array_t* array)

Clear the generators of the array, and then the array itself.

Function: void ap_generator1_array_fprint (FILE* stream, ap_generator1_array_t* array)

Print the array on the stream.

Function: size_t ap_generator1_array_size (ap_generator1_array_t* array)

Return the size of the array.

Function: ap_environment_t* ap_generator1_array_envref (ap_generator1_array_t* array)

Get a reference to the environment. Do not free it.

Function: ap_generator1_t ap_generator1_array_get (ap_generator1_array_t* array, size_t index)

Return the linear generator of the given index Nothing is duplicated, and the result should never be cleared. Modifying the argument or the result is equivalent, except for change of environments

Function: bool ap_generator1_array_set (ap_generator1_array_t* array, size_t index, ap_generator1_t* gen)

Fill the index of the array with the generator. Assumes array->env==gen->env. Nothing is duplicated. The argument should never be cleared. (its environment is dereferenced). If a generator was already stored, it is first cleared. Return true iff problem (index or array->env!=gen->env)

Function: void ap_generator1_array_clear_index (ap_generator1_array_t* array, size_t index)

Clear the generator at index index.

Function: bool ap_generator1_array_extend_environment_with (ap_generator1_array_t* array, ap_environment_t* nenv)
Function: bool ap_generator1_array_extend_environment (ap_generator1_array_t* narray, ap_generator1_array_t* array, ap_environment_t* nenv)

Identical to corresponding ap_linexpr1_XXX functions (see Change of dimensions and permutations of linear expressions of level 1).


Previous: , Up: Generators of level 1