PIPS
scalaires.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
+ Include dependency graph for scalaires.c:

Go to the source code of this file.

Macros

#define FREE(p, t, f)   free(p)
 package vecteur - operations vecteur x scalaire More...
 

Functions

Pvecteur vect_div (Pvecteur v, Value x)
 Pvecteur vect_div(Pvecteur v, Value x): division du vecteur v par le scalaire x, si x est different de 0. More...
 
Pvecteur vect_clean (Pvecteur v)
 Pvecteur vect_clean(Pvecteur v): elimination de tous les couples dont le coefficient vaut 0 dans le vecteur v et renvoie de v. More...
 
Pvecteur vect_multiply (Pvecteur v, Value x)
 Pvecteur vect_multiply(Pvecteur v, Value x): multiplication du vecteur v par le scalaire x, si x est different de 0. More...
 
void vect_chg_sgn (Pvecteur v)
 void vect_chg_sgn(Pvecteur v): multiplie v par -1 More...
 

Macro Definition Documentation

◆ FREE

#define FREE (   p,
  t,
  f 
)    free(p)

package vecteur - operations vecteur x scalaire

INTLIBRARY

Definition at line 39 of file scalaires.c.

Function Documentation

◆ vect_chg_sgn()

void vect_chg_sgn ( Pvecteur  v)

void vect_chg_sgn(Pvecteur v): multiplie v par -1

-> -> v := - v

Definition at line 151 of file scalaires.c.

153 {
154  for( ;v != NULL; v = v->succ)
155  value_oppose(val_of(v));
156 }
#define value_oppose(ref)
struct Svecteur * succ
Definition: vecteur-local.h:92
#define val_of(varval)

References val_of, and value_oppose.

Referenced by __attribute__(), add_affine_bound_conditions(), adg_get_conjonctions(), adg_max_of_leaves(), build_sc_with_several_uniform_ref(), calculate_delay(), change_base_in_sc(), check_positive_dependence(), complex_bound_computation(), constraint_to_bound(), constraints_to_loop_bound(), contrainte_chg_sgn(), contrainte_to_text_2(), create_farkas_poly(), creer_ineg(), dj_simple_inegs_to_eg(), dj_system_complement(), eq_in_ineq(), find_pattern(), get_bounds_expression(), get_exp_schedule(), gomory_trait_eq(), heuristique_3(), loop_executed_approximation(), loop_index_domaine_to_contrainte(), make_constraint_expression(), make_dual(), make_vvs_from_sc(), monome_monome_div(), my_substitute_var_with_vec(), negate_expression(), normalize_intrinsic(), NormalizeIntrinsic(), outliner_smart_references_computation(), pa_path_to_few_disjunct_ofl_ctrl(), print_loopnest_dependence_cone(), Pvecteur_to_assign_statement(), ray_oppose(), sc_of_constrs(), sc_supress_same_constraints(), sc_transform_eg_in_ineg(), separate_variables(), simplify_minmax_contrainte(), substitute_var_with_vec(), sys_int_redond(), test_bound_generation(), tile_hyperplane_constraints(), tile_membership_constraints(), transform_in_ineq(), translate_to_module_frame(), upper_bound_generation(), vect_cl_ofl_ctrl(), vect_div(), vect_multiply(), and xml_Region_Range().

◆ vect_clean()

Pvecteur vect_clean ( Pvecteur  v)

Pvecteur vect_clean(Pvecteur v): elimination de tous les couples dont le coefficient vaut 0 dans le vecteur v et renvoie de v.

Ne devrait JAMAIS etre utilise en dehors de la bibliotheque vecteur. Ne sert qu'a corriger le resultat de vect_div quand la division entiere fait apparaitre un 0. Dans ces cas, vect_div n'est pas lineaire.

Definition at line 80 of file scalaires.c.

82 {
83  Pvecteur v1,v2;
84  Pvecteur pred = v;
85  Pvecteur result=v;
86 
87  for (v1 = v; ((v1!= NULL) && (v1->val != 0)); pred = v1,v1=v1->succ);
88 
89  for (v2 = v1;v2 != NULL; v2 = v2->succ)
90  {
91  if (v2->val == 0)
92  {
93  if (v2 == v)
94  {
95  result = v2->succ;
96  pred = v;
97 
98  }
99  else {
100  pred->succ = v2->succ;
101  v2->succ = NULL;
102  FREE((char*)v2,VECTEUR,"vect_clean");
103  v2 = pred;
104  }
105  }
106  else
107  pred = v2;
108 
109  }
110  return (result);
111 }
#define FREE(p, t, f)
package vecteur - operations vecteur x scalaire
Definition: scalaires.c:39
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Value val
Definition: vecteur-local.h:91
#define VECTEUR
package sur les vecteurs creux et les bases
Definition: vecteur-local.h:51

References FREE, Svecteur::succ, Svecteur::val, and VECTEUR.

Referenced by contrainte_normalize(), gomory_trait_eq(), my_contrainte_normalize(), var_posit(), and vect_div().

+ Here is the caller graph for this function:

◆ vect_div()

Pvecteur vect_div ( Pvecteur  v,
Value  x 
)

Pvecteur vect_div(Pvecteur v, Value x): division du vecteur v par le scalaire x, si x est different de 0.

scalaires.c

-> -> v := v / x; -> -> Si x vaut 0, la procedure aborte meme si v == 0 -> Attention, si x ne divise pas le pgcd des coefficients de v, la valeur retournee n'est pas colineaire a la valeur initiale

Definition at line 52 of file scalaires.c.

55 {
56  if(value_zero_p(x)) {
57  vect_error("vect_div","vector zero divide\n");
58  }
59  else if (value_one_p(x))
60  ;
61  else if(value_mone_p(x))
62  vect_chg_sgn(v);
63  else {
64  Pvecteur coord;
65 
66  for (coord = v ;coord!=NULL;coord=coord->succ) {
67  value_pdivision(val_of(coord),x);
68  }
69  }
70  return vect_clean(v);
71 }
#define value_mone_p(val)
#define value_one_p(val)
#define value_zero_p(val)
#define value_pdivision(ref, val)
Pvecteur vect_clean(Pvecteur v)
Pvecteur vect_clean(Pvecteur v): elimination de tous les couples dont le coefficient vaut 0 dans le v...
Definition: scalaires.c:80
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151
static char * x
Definition: split_file.c:159
void vect_error(char *name, char *fmt,...)
package vecteur
Definition: error.c:50

References Svecteur::succ, val_of, value_mone_p, value_one_p, value_pdivision, value_zero_p, vect_chg_sgn(), vect_clean(), vect_error(), and x.

Referenced by analyze_expression(), calculate_delay(), contrainte_normalize(), make_array_bounds(), make_rational_exp(), my_contrainte_normalize(), sc_find_equalities(), sommet_normalize(), and vect_normalize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vect_multiply()

Pvecteur vect_multiply ( Pvecteur  v,
Value  x 
)

Pvecteur vect_multiply(Pvecteur v, Value x): multiplication du vecteur v par le scalaire x, si x est different de 0.

-> -> v := x v;

Ancien nom: vect_mult() Ancien profil: void vect_mult(); ne permettait pas de renvoyer un vecteur nul en cas de multiplication par zero d'un vecteur non nul

Definition at line 123 of file scalaires.c.

126 {
127  Pvecteur coord;
128 
129  if (value_zero_p(x))
130  {
131  vect_rm(v);
132  return VECTEUR_NUL;
133  }
134  else if (value_one_p(x))
135  return v;
136  else if (value_mone_p(x))
137  vect_chg_sgn(v);
138  else
139  for(coord = v; coord!=NULL; coord=coord->succ)
140  value_product(val_of(coord), x);
141 
142  return v;
143 }
#define value_product(v, w)
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78

References Svecteur::succ, val_of, value_mone_p, value_one_p, value_product, value_zero_p, vect_chg_sgn(), vect_rm(), VECTEUR_NUL, and x.

Referenced by analyze_expression(), array_indices_communication(), bounds_equal_p(), build_convex_constraints_from_vertices(), build_list_of_min(), build_sc_machine(), build_third_comb(), constraints_eliminate_constant_terms(), contrainte_parallele(), eq_in_ineq(), expression_equal_in_context_p(), find_intermediate_constraints(), find_intermediate_constraints_recursively(), full_linearization(), generic_minmax_to_transformer(), include_trans_in_sc(), include_trans_on_LC_in_ref(), integer_divide_to_transformer(), integer_minmax_to_transformer(), integer_power_to_transformer(), integer_right_shift_to_transformer(), loop_bound_evaluation_to_transformer(), make_bound_expression(), make_context_of_loop(), my_vect_var_subst(), normalize_intrinsic(), NormalizeIntrinsic(), partial_linearization(), pivoter(), prepare_reindexing(), sc_lexicographic_sort(), sc_oppose(), sc_to_tableau(), simplify_dimension(), simplify_predicate(), small_positive_slope_reduce_coefficients_with_bounding_box(), system_new_var_subst(), transformer_add_condition_information_updown(), valuer(), vect_change_base(), vect_cl_ofl_ctrl(), vect_product(), and vect_var_subst().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: