PIPS
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "linear_assert.h"
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
Go to the source code of this file.
Functions | |
Pbase | vect_add_variable (Pbase b, Variable v) |
package vecteur - routines sur les bases More... | |
Pbase | base_add_variable (Pbase b, Variable var) |
Pbase base_add_variable(Pbase b, Variable v): add variable v as a new dimension to basis b at the end of the base list; if variable v is already in basis b, do nothing; this is not clean but convenient to avoid a test;. More... | |
Pbase | make_base_from_vect (Pvecteur pv) |
Pbase | base_remove_variable (Pbase b, Variable v) |
Pbase base_remove_variable(b, v): remove basis vector relative to v from b; abort if v is not in b;. More... | |
bool | base_contains_variable_p (Pbase b, Variable v) |
bool base_contains_variable_p(Pbase b, Variable v): returns true if variable v is one of b's elements; More... | |
Variable | base_find_variable (Pbase b, Variable v) |
Variable base_find_variable(Pbase b, Variable v): returns variable v if variable v is one of b's elements (returns a pointer to the copy of v that's pointed to by basis b); else returns VARIABLE_UNDEFINED. More... | |
Variable | base_find_variable_name (Pbase b, Variable v, char *(*variable_name)(Variable)) |
Variable base_find_variable_name(Pbase b, Variable v, char * (*variable_name)()): returns the variable (i.e. More... | |
int | base_find_variable_rank (Pbase b, Variable v, char *(*variable_name)(Variable)) |
int base_find_variable_rank(Pbase b, Variable v, char * (*variable_name)()): returns variable v's rank if it is in basis b, else -1 More... | |
Pbase | base_reversal (Pbase b_in) |
Pbase base_reversal(Pbase b_in): produces a basis b_out, having the same basis vectors as b_in, but in reverse order. More... | |
Pvecteur | vect_rename (Pvecteur v, Pbase b, char *(*variable_name)(Variable)) |
Pvecteur vect_rename(Pvecteur v, Pbase b, char * (*variable_name)()): modify vector v so that its coordinates are relative to basis b; each basis vector is defined by a pointer of type Variable, but different pointers can point to the same basis vector wrt variable_name; these pointers are unified with respect to b and variable_name to let us perform eq-type comparison in the library. More... | |
Pvecteur | vect_rename_variables (Pvecteur v, bool(*renamed_p)(Variable), Variable(*new_variable)(Variable)) |
Pvecteur vect_rename_variables(v, renamed_p, new_variable) Pvecteur v; bool (*renamed_p)(Variable); Variable (*new_variable)(Variable);. More... | |
Pvecteur | vect_translate (Pvecteur v, Pbase b, char *(*variable_name)(Variable)) |
Pvecteur vect_translate(Pvecteur v, Pbase b, char * (*variable_name)()): modify vector v so that its coordinates are relative to basis b; each basis vector is defined by a pointer of type Variable, but different pointers can point to the same basis vector wrt variable_name; these pointers are unified with respect to b and variable_name to let us perform eq-type comparison in the library. More... | |
bool | vect_in_basis_p (Pvecteur v, Pbase b) |
Pvecteur vect_in_basis_p(Pvecteur v, Pbase b): check that all coordinates in v are in b, i.e. More... | |
Pvecteur | vect_variable_rename (Pvecteur v, Variable v_old, Variable v_new) |
Pvecteur vect_variable_rename(Pvecteur v, Variable v_old, Variable v_new): rename the potential coordinate v_old in v as v_new. More... | |
void | base_append (Pbase *pb1, Pbase b2) |
appends b2 to b1. More... | |
Pbase | base_union (Pbase b1, Pbase b2) |
Pbase base_union(Pbase b1, Pbase b2): compute a new basis containing all elements of b1 and all elements of b2, in an unkown order. More... | |
Pbase | base_intersection (Pbase b1, Pbase b2) |
Return variables/dimensions present in bases b1 and b2. More... | |
int | rank_of_variable (Pbase base, Variable var) |
this function returns the rank of the variable var in the base 0 encodes TCST, but I do not know why, TCST may be in base, sometimes -1 encodes an error More... | |
Variable | variable_of_rank (Pbase base, int rank) |
Variable variable_of_rank(): this function returns the variable of rank "rank". More... | |
int | search_higher_rank (Pvecteur vect, Pbase base) |
int search_higher_rank(): this fonction returns the rank of the variable of higher rank in the vecteur More... | |
Variable | search_var_of_higher_rank (Pvecteur pvect, Pbase base, Variable var) |
this function returns the variable of higher rank, after the variable var, in the vecteur pvect More... | |
Pvecteur | search_i_element (Pbase b, int i) |
Pvecteur search_i_element(): recherche du i-ieme couple (var,val) dans la Pbase b. More... | |
Pbase | base_normalize (Pbase b) |
bool | base_normalized_p (Pbase b) |
Pbase | base_difference (Pbase b1, Pbase b2) |
Pbase base_difference(Pbase b1, Pbase b2): allocate b; b = b1 - b2 – with the set meaning return b;. More... | |
bool | base_included_p (Pbase b1, Pbase b2) |
Pbase base_included_p(Pbase b1, Pbase b2): include_p = b1 is included in b2 – with the set meaning return b;. More... | |
bool | bases_strictly_equal_p (Pbase b1, Pbase b2) |
Make sure that each dimension of b1 is the same dimension in b2. More... | |
Pbase base_add_variable(Pbase b, Variable v): add variable v as a new dimension to basis b at the end of the base list; if variable v is already in basis b, do nothing; this is not clean but convenient to avoid a test;.
Note that basis b contains a pointer towards variable v and not a copy of it. So some sharing is introduced.
A routine to check variable equality, variable_equal(), is used.
var | ar |
Definition at line 88 of file base.c.
References b1, VALUE_ONE, variable_equal(), vect_new(), VECTEUR_NUL_P, and vecteur_var.
Referenced by add_constraint_on_x(), base_intersection(), build_and_test_dependence_context(), copy_write_statement_with_cumulated_regions(), generic_minmax_to_transformer(), include_parameters_in_sc(), local_tile_constraints(), main(), make_base_from_vect(), make_base_phi_variables(), new_system_with_only_live_variable(), region_to_com_nest(), region_to_loop_nest(), sc_safe_append(), TestDependence(), transformer_add_loop_index_incrementation(), transformer_add_sign_information(), transformer_add_value_update(), transformer_add_variable_update(), transformer_derivative_fix_point(), transformer_list_generic_transitive_closure(), and vect_change_base().
appends b2 to b1.
modifies b1. b2 is not modified.
pb1 | b1 |
b2 | 2 |
Definition at line 384 of file base.c.
References b2, base_copy(), BASE_NULLE_P, linear_hashtable_free(), linear_hashtable_isin(), linear_hashtable_make(), linear_hashtable_put_once(), seen, Svecteur::succ, TCST, VALUE_ONE, var_of, and vect_chain().
Referenced by sc_append().
bool base_contains_variable_p(Pbase b, Variable v): returns true if variable v is one of b's elements;
Based on variable_equal()
Definition at line 136 of file base.c.
References variable_equal(), VECTEUR_NUL_P, and vecteur_var.
Referenced by add_bounding_box_constraints(), add_type_information(), base_difference(), base_intersection(), base_remove_variable(), build_transfer_equations(), cell_reference_sc_exact_projection_along_variable(), fortran_user_call_to_transformer(), include_trans_on_LC_in_ref(), my_system_remove_variables(), new_ident(), new_system_with_only_live_variable(), partial_eval_reference(), precondition_intra_to_inter(), region_exact_projection_along_parameters(), region_exact_projection_along_variable(), safe_transformer_projection(), sc_minmax_of_variable2(), sc_multiply_constant_terms(), sc_projection_ofl_along_list_of_variables(), separate_variables(), separate_variables_2(), simplify_dimension(), simplify_predicate(), sub_basis_p(), system_contains_var(), transform_in_ineq(), transformer_add_value_update(), transformer_add_variable_update(), transformer_argument_general_consistency_p(), transformer_arguments_projection(), transformer_combine(), transformer_convex_hulls(), transformer_filter(), transformer_projection_with_redundancy_elimination_and_check(), transformer_range(), transformer_to_1D_lattice(), transformer_to_domain(), transformer_value_substitutable_p(), transformer_value_substitute(), translate_global_value(), translate_to_module_frame(), vect_in_basis_p(), and vect_read().
Pbase base_difference(Pbase b1, Pbase b2): allocate b; b = b1 - b2 – with the set meaning return b;.
b1 | 1 |
b2 | 2 |
Definition at line 621 of file base.c.
References b1, b2, base_contains_variable_p(), BASE_NULLE, BASE_NULLE_P, BASE_UNDEFINED, Svecteur::succ, vect_add_variable(), and vecteur_var.
Referenced by algorithm_row_echelon_generic(), build_transfer_equations(), get_other_constraints(), sc_consistent_p(), and set_sort_context().
Variable base_find_variable(Pbase b, Variable v): returns variable v if variable v is one of b's elements (returns a pointer to the copy of v that's pointed to by basis b); else returns VARIABLE_UNDEFINED.
Based on variable_equal()
Definition at line 155 of file base.c.
References variable_equal(), VARIABLE_UNDEFINED, VECTEUR_NUL_P, and vecteur_var.
Referenced by matrice_index_sys(), rec_ident(), and vect_read().
Variable base_find_variable_name(Pbase b, Variable v, char * (*variable_name)()): returns the variable (i.e.
coord) in b that has the same name as v; else returns VARIABLE_UNDEFINED
Definition at line 170 of file base.c.
References variable_name(), VARIABLE_UNDEFINED, VECTEUR_NUL_P, and vecteur_var.
Referenced by sc_variables_rename(), vect_rename(), and vect_translate().
int base_find_variable_rank(Pbase b, Variable v, char * (*variable_name)()): returns variable v's rank if it is in basis b, else -1
Definition at line 194 of file base.c.
References rank, variable_name(), VECTEUR_NUL_P, and vecteur_var.
Referenced by egalites_to_matrice(), make_bound_expression(), and vect_change_base().
Pbase base_included_p(Pbase b1, Pbase b2): include_p = b1 is included in b2 – with the set meaning return b;.
b1 | 1 |
b2 | 2 |
Definition at line 640 of file base.c.
References b1, b2, linear_hashtable_free(), linear_hashtable_isin(), linear_hashtable_make(), linear_hashtable_put_once(), seen, Svecteur::succ, TCST, and var_of.
Referenced by sc_weak_consistent_p().
Return variables/dimensions present in bases b1 and b2.
Order is not preserved.
b1 | 1 |
b2 | 2 |
Definition at line 473 of file base.c.
References b1, b2, base_add_variable(), base_contains_variable_p(), BASE_NULLE, BASE_NULLE_P, BASE_UNDEFINED_P, vecteur_succ, and vecteur_var.
Referenced by sc_projection_optim_along_vecteur_ofl().
Definition at line 594 of file base.c.
References BASE_NULLE_P, Svecteur::succ, VALUE_ONE, and vecteur_val.
Referenced by pip_solve(), pip_solve_min_with_big(), set_sort_context(), and vars_read_and_written().
Definition at line 604 of file base.c.
References BASE_NULLE_P, Svecteur::succ, value_one_p, vect_check(), and vecteur_val.
Referenced by sc_consistent_p(), and sc_weak_consistent_p().
Pbase base_remove_variable(b, v): remove basis vector relative to v from b; abort if v is not in b;.
Definition at line 122 of file base.c.
References assert, base_contains_variable_p(), and vect_erase_var().
Referenced by main(), sc_base_remove_variable(), transformer_derivative_fix_point(), and transformer_list_generic_transitive_closure().
Pbase base_reversal(Pbase b_in): produces a basis b_out, having the same basis vectors as b_in, but in reverse order.
Basis b_in is not touched.
Example: b_in = { e1, e2, e3 } -> b_out = { e3, e2, e1}
b_in | _in |
Definition at line 221 of file base.c.
References vect_add_elem(), VECTEUR_NUL, VECTEUR_NUL_P, vecteur_val, and vecteur_var.
Referenced by adg_sc_dup(), algorithm_row_echelon_generic(), build_image_base(), code_generation(), compute_iteration_domain(), create_tile_basis(), derive_new_basis(), list_to_base(), loop_nest_to_wp65_code(), matrices_to_loop_sc(), matrices_to_sc(), parallel_tiling(), sc_projection_concat_proj_on_variables(), set_sort_context(), and tiling_transformation().
Pbase base_union(Pbase b1, Pbase b2): compute a new basis containing all elements of b1 and all elements of b2, in an unkown order.
b := b1 u b2; return b;
Bases b1 and b2 are not modified. Basis vectors are compared for equality using variable_equal()
Modifications:
b1 | 1 |
b2 | 2 |
Definition at line 428 of file base.c.
References b1, b2, base_copy(), BASE_NULLE, BASE_NULLE_P, linear_hashtable_free(), linear_hashtable_isin(), linear_hashtable_make(), linear_hashtable_put_once(), seen, Svecteur::succ, TCST, VALUE_ONE, var_of, and vect_chain().
Referenced by actual_convex_union(), elementary_convex_union(), gcd_and_constant_dependence_test(), is_inferior_monome(), matrices_to_constraints_with_sym_cst(), matrices_to_contraintes_with_sym_cst(), pip_solve(), pip_solve_min_with_big(), polynome_used_var(), regions_must_convex_hull(), sc_constraint_add(), sc_cute_convex_hull(), sc_elim_redund_with_first_ofl_ctrl(), sg_union(), simplify_float_constraint_system(), sl_fprint_tab(), transformer_add_loop_index_initialization(), transformer_convex_hulls(), and transformer_list_generic_transitive_closure().
Make sure that each dimension of b1 is the same dimension in b2.
b1 | 1 |
b2 | 2 |
Definition at line 660 of file base.c.
References b1, b2, base_dimension, s1, and variable_of_rank().
Referenced by sc_union().
pv | v |
Definition at line 109 of file base.c.
References base_add_variable(), Svecteur::succ, TCST, Svecteur::var, and VECTEUR_NUL_P.
Referenced by efficient_sc_check_inequality_feasibility(), sc_normalize2(), and transformer_add_loop_index_initialization().
this function returns the rank of the variable var in the base 0 encodes TCST, but I do not know why, TCST may be in base, sometimes -1 encodes an error
not found
base | ase |
var | ar |
Definition at line 497 of file base.c.
References base, rank, Svecteur::succ, TCST, VECTEUR_NUL_P, and vecteur_var.
Referenced by bound_generation(), build_transfer_matrix(), compare_variables_in_base(), constraint_distribution(), constraint_integer_combination(), contrainte_extract(), reference_conversion_computation(), reference_conversion_expression(), reference_translation(), sc_elim_triang_integer_redund_constraint_p(), sc_integer_projection_information(), sc_normalize2(), search_higher_rank(), search_var_of_higher_rank(), and transformer_to_1D_lattice().
int search_higher_rank(): this fonction returns the rank of the variable of higher rank in the vecteur
vect | ect |
base | ase |
Definition at line 541 of file base.c.
References base, rank_of_variable(), Svecteur::succ, VECTEUR_NUL_P, and vecteur_var.
Referenced by bound_distribution(), build_integer_sc_nredund(), constraint_distribution(), contrainte_extract(), egalite_distribution(), elim_redund_sc_with_sc(), lower_bound_generation(), sc_integer_projection_information(), test_bound_generation(), and upper_bound_generation().
this function returns the variable of higher rank, after the variable var, in the vecteur pvect
pvect | vect |
base | ase |
var | ar |
Definition at line 561 of file base.c.
References base, rank_of_variable(), Svecteur::succ, TCST, VECTEUR_NUL_P, and vecteur_var.
Variable variable_of_rank(): this function returns the variable of rank "rank".
base | ase |
rank | ank |
Definition at line 520 of file base.c.
References base, rank, Svecteur::succ, TCST, VECTEUR_NUL_P, and vecteur_var.
Referenced by bases_strictly_equal_p().
package vecteur - routines sur les bases
Francois Irigoin
The function variable_name should be inlined as much as possible to improve performances. It has to be used to be generic over the "Variable" type. For instance, variables represented by a character string cannot be decided equal by a simple pointer comparison.
Modifications: INTLIBRARY Pbase vect_add_variable(Pbase b, Variable v): add variable v as a new dimension to basis b; if variable v is already in basis b, do nothing; this is not clean but convenient to avoid a test;
Note that basis b contains a pointer towards variable v and not a copy of it. So some sharing is introduced.
A routine to check variable equality, variable_equal(), is used.
Definition at line 61 of file base.c.
References b1, base_add_dimension, variable_equal(), VECTEUR_NUL, VECTEUR_NUL_P, and vecteur_var.
Referenced by add_var_sup(), args_to_transformer(), base_difference(), build_sc_machine(), build_sc_with_several_uniform_ref(), create_tile_basis(), equations_to_bases(), filter_transformer(), loop_bounds_to_tile_bounds(), loop_index_domaine_to_contrainte(), MakeDibaseinorder(), module_to_wp65_modules(), new_ident(), sc_add_new_variable_name(), set_dimensions_of_local_variable_family(), transformer_add_modified_variable(), transformer_add_modified_variable_entity(), transformer_add_variable_incrementation(), var_ecart_sup(), and vect_read().
Pvecteur vect_in_basis_p(Pvecteur v, Pbase b): check that all coordinates in v are in b, i.e.
vector v is a membre of the space generated by b
Bugs:
I do not know what should be done for constant terms...
Definition at line 342 of file base.c.
References abort, base_contains_variable_p(), Svecteur::succ, VARIABLE_DEFINED_P, VECTEUR_NUL_P, and vecteur_var.
Referenced by algorithm_row_echelon_generic(), gcd_and_constant_dependence_test(), legal_point_p(), print_cone_vecteur(), and vect_fprint_as_dense().
Pvecteur vect_rename(Pvecteur v, Pbase b, char * (*variable_name)()): modify vector v so that its coordinates are relative to basis b; each basis vector is defined by a pointer of type Variable, but different pointers can point to the same basis vector wrt variable_name; these pointers are unified with respect to b and variable_name to let us perform eq-type comparison in the library.
This function is identical to vect_translate, except that if a variable var of v does not appear in b, then the assert is not executed.
Bugs:
Definition at line 247 of file base.c.
References base_find_variable_name(), Svecteur::succ, VARIABLE_DEFINED_P, variable_name(), VARIABLE_UNDEFINED_P, VECTEUR_NUL_P, and vecteur_var.
Referenced by movement_computation().
Pvecteur vect_rename_variables | ( | Pvecteur | v, |
bool(*)(Variable) | renamed_p, | ||
Variable(*)(Variable) | new_variable | ||
) |
Pvecteur vect_rename_variables(v, renamed_p, new_variable) Pvecteur v; bool (*renamed_p)(Variable); Variable (*new_variable)(Variable);.
what: driven renaming of variables in v. how: scans the vector, decides and replaces. input: Pvecteur v, decision and replacement functions. output: v is returned (the same) side effects:
initial vector is kept
ar!=TCST &&
Definition at line 281 of file base.c.
References new_variable, Svecteur::succ, and var_of.
Referenced by sc_rename_variables(), and vect_variables_to_values().
Pvecteur vect_translate(Pvecteur v, Pbase b, char * (*variable_name)()): modify vector v so that its coordinates are relative to basis b; each basis vector is defined by a pointer of type Variable, but different pointers can point to the same basis vector wrt variable_name; these pointers are unified with respect to b and variable_name to let us perform eq-type comparison in the library.
Bugs:
Definition at line 313 of file base.c.
References assert, base_find_variable_name(), Svecteur::succ, VARIABLE_DEFINED_P, variable_name(), VARIABLE_UNDEFINED_P, VECTEUR_NUL_P, and vecteur_var.
Referenced by contrainte_translate(), and sc_translate().
Pvecteur vect_variable_rename(Pvecteur v, Variable v_old, Variable v_new): rename the potential coordinate v_old in v as v_new.
v_old | _old |
v_new | _new |
Definition at line 366 of file base.c.
References Svecteur::succ, VECTEUR_NUL_P, and vecteur_var.
Referenced by affine_to_transformer(), contrainte_variable_rename(), sc_variable_rename(), upwards_vect_rename(), and variables_to_new_values().