PIPS
|
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include "boolean.h"
#include "linear_assert.h"
#include "arithmetique.h"
#include "vecteur.h"
Go to the source code of this file.
Functions | |
int | vect_size (Pvecteur v) |
package vecteur - reductions More... | |
int | vect_dimension (Pvecteur v) |
int vect_dimension(Pvecteur v): calcul du nombre de composantes non nulles et non constantes d'un vecteur More... | |
Value | vect_prod_scal (Pvecteur v1, Pvecteur v2) |
Value vect_prod_scal(v1,v2): produit scalaire de v1 et de v2. More... | |
Value | vect_pgcd_all (Pvecteur v) |
Value vect_pgcd(Pvecteur v): calcul du pgcd de tous les coefficients non nul d'un vecteur v. More... | |
Value | vect_pgcd_except (Pvecteur v, Variable var) |
Value vect_pgcd_except(Pvecteur v, Variable var): calcul du pgcd de tous les coefficients non nul d'un vecteur v, sauf le coefficient correspondant a la variable var. More... | |
Value | vect_max0 (Pvecteur v) |
Value vect_max0(Pvecteur v): recherche du coefficient maximum d'un vecteur v; ce coefficient est toujours au moins egal a 0 car on ne dispose pas d'une base pour verifier que TOUS les coefficients sont negatifs. More... | |
Value | vect_min0 (Pvecteur v) |
Value vect_min0(Pvecteur v): recherche du coefficient minimum d'un vecteur v; ce coefficient est toujours au moins egal a 0 car on ne dispose pas d'une base pour verifier que TOUS les coefficients sont negatifs. More... | |
Value | vect_min (Pvecteur v) |
Value vect_min(Pvecteur v): recherche du coefficient non nul minimum d'un vecteur v; aborte sur le vecteur 0 puisqu'il faudrait renvoyer plus l'infini. More... | |
Value | vect_max (Pvecteur v) |
Value vect_max(Pvecteur v): recherche du coefficient non nul maximum d'un vecteur v; aborte sur le vecteur 0 puisqu'il faudrait renvoyer plus l'infini. More... | |
Value | vect_sum (Pvecteur v) |
Value vect_sum(Pvecteur v): somme des coefficients d'un vecteur (i.e. More... | |
bool | vect_equal (Pvecteur v1, Pvecteur v2) |
bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs More... | |
bool | vect_equal_except (Pvecteur v1, Pvecteur v2, Variable var) |
bool vect_equal_except(Pvecteur v1, Pvecteur v2, Variable var): test a egalite des projections selon la coordonnees var de deux vecteurs -> Soit e un vecteur de base quelconque: -> -> -> -> return <v1 . More... | |
bool | vect_oppos (Pvecteur v1, Pvecteur v2) |
bool vect_oppos(Pvecteur v1, Pvecteur v2): test de l'opposition de deux vecteurs More... | |
bool | vect_opposite_except (Pvecteur v1, Pvecteur v2, Variable var) |
bool vect_opposite_except(Pvecteur v1, Pvecteur v2, Variable var): test a egalite des projections selon la coordonnees var de deux vecteurs -> Soit e un vecteur de base quelconque: -> -> -> -> return <v1 . More... | |
int | vect_proport (Pvecteur v1, Pvecteur v2) |
int vect_proport(Pvecteur v1, Pvecteur v2): test de la colinearite de deux vecteurs et de leur direction. More... | |
bool | vect_colin_base (Pvecteur vec, Variable var) |
bool vect_colin_base(Pvecteur vec, Variable var): renvoie true si --> --> vec = k var More... | |
bool | vect_check (Pvecteur cv) |
bool vect_check(Pvecteur v): renvoie true si le vecteur v est coherent avec les specifications du package; aucun des coefficients effectivement conserves en memoire ne doit etre nul (la cellule aurait du etre liberee) et aucune dimension (i.e. More... | |
bool | vect_consistent_p (Pvecteur v) |
To ease retrieval of vect_check() More... | |
bool | vect_larger_coef_p (Pvecteur v, Value val) |
bool vect_check(Pvecteur v): renvoie true si le vecteur v est coherent avec les specifications du package; aucun des coefficients effectivement conserves en memoire ne doit etre nul (la cellule aurait du etre liberee) et aucune dimension (i.e.
variable) ne peut apparaitre deux fois.
Ces conditions ne sont pas verifiees par Corinne dans ses routines du package "sommet".
new version to test linear_hashtable. better for large vectors, but much worse for small ones I guess. FC.
Especially for the NULL vector. FI.
cv | v |
Definition at line 529 of file reductions.c.
References linear_hashtable_free(), linear_hashtable_isin(), linear_hashtable_make(), linear_hashtable_put(), seen, Svecteur::succ, val_of, value_notzero_p, and var_of.
Referenced by adg_contrainte_fprint(), base_normalized_p(), contrainte_fprint(), contrainte_sprint_format(), contrainte_text_format(), monome_check(), pu_contrainte_fprint(), and vect_consistent_p().
bool vect_colin_base(Pvecteur vec, Variable var): renvoie true si --> --> vec = k var
false sinon
Attention: le vecteur nul est colineaire a tous les vecteurs de base
vec | ec |
var | ar |
Definition at line 508 of file reductions.c.
References var_of.
To ease retrieval of vect_check()
Definition at line 557 of file reductions.c.
References vect_check().
int vect_dimension(Pvecteur v): calcul du nombre de composantes non nulles et non constantes d'un vecteur
sum abs(sgn(v[i])) i
Definition at line 64 of file reductions.c.
References Svecteur::succ, and term_cst.
Referenced by choose_pattern(), find_pattern(), print_call_precondition(), sc_minmax_of_variable2(), sc_strong_normalize_and_check_feasibility2(), and xml_Pattern_Paving().
bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs
-> ->
return v1 == v2 ;
Note: le test n'est pas optimal puisque v2 est parcouru et compare a v1 meme si ces coefficients ont ete deja ete compare lors du parcours de v1; mais cela evite le "marquage" des coefficients vus;
shorter version, FC 28/09/94
v1 must be preserved for the second loop: use v
now v2 may be lost: use v2
v1 | 1 |
v2 | 2 |
Definition at line 278 of file reductions.c.
References Svecteur::succ, val_of, value_eq, var_of, and vect_coeff().
Referenced by adg_quast_leaf_solution_equal_p(), adg_suppress_2nd_in_1st_ps(), call_rwt(), contrainte_equal(), contrainte_in_liste(), dte_in_sg_p(), egaliste_rd(), egalite_equal(), egalite_in_liste(), exp_equals_p(), free_guards(), monome_colin(), monome_equal(), polynome_constant_p(), polynome_TCST(), ray_in_sg_p(), rd_in_liste(), same_expression_p(), semantics_is_inferior_pvarval(), som_in_liste(), sommet_egal(), sommet_in_sg_p(), suppress_sc_in_sc(), and vect_lexicographic_unsafe_compare_generic().
bool vect_equal_except(Pvecteur v1, Pvecteur v2, Variable var): test a egalite des projections selon la coordonnees var de deux vecteurs -> Soit e un vecteur de base quelconque: -> -> -> -> return <v1 .
e> == <v2 . e>; e!=var
v1 | 1 |
v2 | 2 |
var | ar |
Definition at line 319 of file reductions.c.
References Svecteur::succ, val_of, value_eq, var_of, and vect_coeff().
Referenced by eq_smg(), and sc_elim_double_constraints().
v | vecteur being scanned |
val | maximum absolute value allowed, or 0 to ignore |
val | al |
Definition at line 564 of file reductions.c.
References linear_assert, Svecteur::succ, val_of, value_gt, value_lt, value_posz_p, value_uminus, value_zero_p, and var_of.
Referenced by contrainte_remove_large_coef().
Value vect_max(Pvecteur v): recherche du coefficient non nul maximum d'un vecteur v; aborte sur le vecteur 0 puisqu'il faudrait renvoyer plus l'infini.
max v[i] i v[i]!=0
Note: changement de semantique puisque 0 etait renvoye auparavant pour le vecteur 0
Modifications:
Definition at line 240 of file reductions.c.
References max, val_of, value_max, VALUE_NAN, and vect_error().
Value vect_max0(Pvecteur v): recherche du coefficient maximum d'un vecteur v; ce coefficient est toujours au moins egal a 0 car on ne dispose pas d'une base pour verifier que TOUS les coefficients sont negatifs.
Note: on evite le probleme du vecteur de dimension 0 dont le max vaut moins l'infini
Definition at line 164 of file reductions.c.
References max, val_of, value_max, and VALUE_ZERO.
Value vect_min(Pvecteur v): recherche du coefficient non nul minimum d'un vecteur v; aborte sur le vecteur 0 puisqu'il faudrait renvoyer plus l'infini.
min v[i] i v[i]!=0
Note: changement de semantique puisque 0 etait renvoye auparavant pour le vecteur 0
just to avoid a gcc warning
Definition at line 208 of file reductions.c.
References min, val_of, value_min, VALUE_NAN, and vect_error().
Value vect_min0(Pvecteur v): recherche du coefficient minimum d'un vecteur v; ce coefficient est toujours au moins egal a 0 car on ne dispose pas d'une base pour verifier que TOUS les coefficients sont negatifs.
Note: on evite le probleme du vecteur de dimension 0 dont le min vaut moins l'infini
Definition at line 186 of file reductions.c.
References min, val_of, value_min, and VALUE_ZERO.
bool vect_oppos(Pvecteur v1, Pvecteur v2): test de l'opposition de deux vecteurs
-> -> ->
return v1 + v2 == 0 ;
v1 | 1 |
v2 | 2 |
Definition at line 360 of file reductions.c.
References Svecteur::succ, val_of, value_eq, value_uminus, var_of, and vect_coeff().
Referenced by contrainte_oppos(), egalite_equal(), egalite_in_liste(), and free_guards().
bool vect_opposite_except(Pvecteur v1, Pvecteur v2, Variable var): test a egalite des projections selon la coordonnees var de deux vecteurs -> Soit e un vecteur de base quelconque: -> -> -> -> return <v1 .
e> == - <v2 . e>; e!=var
v1 | 1 |
v2 | 2 |
var | ar |
Definition at line 399 of file reductions.c.
References Svecteur::succ, val_of, value_eq, value_uminus, var_of, and vect_coeff().
Referenced by find_motif(), and inequalities_opposite_p().
Value vect_pgcd(Pvecteur v): calcul du pgcd de tous les coefficients non nul d'un vecteur v.
return PGCD v[i] i v[i]!=0
Renvoie 1 pour le vecteur nul (ca devrait etre +infinity)
Definition at line 108 of file reductions.c.
References pgcd, val_of, value_abs, value_notone_p, and VALUE_ONE.
Referenced by analyze_expression(), calculate_delay(), gomory_trait_eq(), make_array_bounds(), make_rational_exp(), sc_find_equalities(), sommet_normalize(), and vect_normalize().
Value vect_pgcd_except(Pvecteur v, Variable var): calcul du pgcd de tous les coefficients non nul d'un vecteur v, sauf le coefficient correspondant a la variable var.
return PGCD v[i] i!=var v[i]!=0
Renvoie 1 pour le vecteur nul (ca devrait etre +infinity)
skip var's coeff if it comes first
var | ar |
Definition at line 130 of file reductions.c.
References pgcd, Svecteur::succ, val_of, value_abs, value_notone_p, VALUE_ONE, and var_of.
Referenced by contrainte_normalize(), and my_contrainte_normalize().
Value vect_prod_scal(v1,v2): produit scalaire de v1 et de v2.
sum v1[i] * v2[i] i
v1 | 1 |
v2 | 2 |
Definition at line 82 of file reductions.c.
References val_of, value_addto, value_product, VALUE_ZERO, var_of, and vect_coeff().
int vect_proport(Pvecteur v1, Pvecteur v2): test de la colinearite de deux vecteurs et de leur direction.
return 1 si les deux vecteurs sont colineaires et dans la meme direction c2 v1 == c1 v1, c1*c2 > 0 c'est le cas si v1 ou v2 vaut le vecteur nul -1 si les deux vecteurs sont colineaires et dans des directions opposees c2 v1 == c1 v1, c1*c2 < 0 0 s'ils ne sont pas colineaires
-> -> ->
Note: aborte pour v1 == v2 == 0 parce qu'il est impossible de decider entre le retour de 1 et de -1
Modifications:
v1 | 1 |
v2 | 2 |
Definition at line 455 of file reductions.c.
References Svecteur::succ, val_of, value_eq, value_mult, value_pos_p, value_product, var_of, vect_coeff(), and vect_error().
package vecteur - reductions
reductions.c
INTLIBRARY int vect_size(Pvecteur v): calcul du nombre de composantes non nulles d'un vecteur
sum abs(sgn(v[i])) i
Definition at line 47 of file reductions.c.
Referenced by actual_convex_union(), add_elem_to_list_of_Pvecteur(), affine_expression_of_loop_index_p(), algorithm_row_echelon_generic(), alignment_p(), args_to_transformer(), bound_generation(), build_sc_with_several_uniform_ref(), check_tiling_legality(), choose_pattern(), chose_variable_to_project_for_feasability(), constant_constraint_check(), constraint_distribution(), constraints_sort_info(), constraints_sort_with_compare(), constraints_with_sym_cst_to_matrices(), contrainte_normalize(), contrainte_parallele(), contrainte_simple_equality(), dependence_cone_positive(), do_group_statement_constant(), eligible_for_coefficient_reduction_with_bounding_box_p(), EvalNormalized(), expression_and_precondition_to_integer_interval(), expression_integer_constant_p(), find_motif(), find_pattern(), gcd_and_constant_dependence_test(), hpfc_integer_constant_expression_p(), HpfcExpressionToInt(), look_for_the_best_counter(), loop_nest_to_tile(), loop_nest_to_wp65_code(), main(), make_constraint_expression(), make_loop_indice_equation(), make_reindex(), matrices_to_loop_sc(), movement_computation(), my_constraints_with_sym_cst_to_matrices(), normalized_constant_p(), parallel_tiling(), pip_solve(), pip_solve_min_with_big(), polynome_roots(), print_call_precondition(), region_range_nul_p(), sc_append(), sc_bounded_normalization(), sc_build_triang_elim_redund(), sc_creer_base(), sc_cute_convex_hull(), sc_dup1(), sc_elim_db_constraints(), sc_elim_double_constraints(), sc_elim_redund_with_first_ofl_ctrl(), sc_empty_p(), sc_gen_read(), sc_image_computation(), sc_kill_db_eg(), sc_normalize2(), sc_projection_concat_proj_on_variables(), sc_restricted_to_variables_transitive_closure(), sc_safe_append(), sc_safe_elim_db_constraints(), sc_safe_kill_db_eg(), sc_to_tableau(), sc_triang_elim_redund(), set_dimensions_of_local_variables(), shift_expression_of_loop_index_p(), simple_indices_p(), simplify_constraint_with_bounding_box(), simplify_float_constraint(), single_var_vecteur_p(), sl_fprint_tab(), small_slope_and_first_quadrant_p(), sort_unknowns(), the_index_of_vect(), transformer_add_value_update(), transformer_add_variable_incrementation(), transformer_add_variable_update(), transformer_derivative_fix_point(), transformer_filter(), transformer_list_generic_transitive_closure(), transformer_normalize(), transformer_projection_with_redundancy_elimination_and_check(), try_reorder_expression_call(), uniform_dependence_p(), vect_const_p(), vect_lexicographic_unsafe_compare_generic(), vect_simple_definition_p(), vect_sort_in_place(), and xml_LoopOffset().
Value vect_sum(Pvecteur v): somme des coefficients d'un vecteur (i.e.
produit scalaire avec le vecteur 1)
sum v[i] i
Definition at line 261 of file reductions.c.
References Svecteur::succ, sum(), val_of, value_addto, and VALUE_ZERO.
Referenced by do_computation_intensity(), polynome_max_degree(), and polynomial_to_numerical().