PIPS
change_of_Pbase.c
Go to the documentation of this file.
1 /*
2 
3  $Id: change_of_Pbase.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 /* package conversion
28 */
29 
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <stdlib.h>
33 
34 #include "linear.h"
35 
36 #include "genC.h"
37 #include "ri.h"
38 #include "ri-util.h"
39 
40 #include "boolean.h"
41 #include "vecteur.h"
42 #include "contrainte.h"
43 #include "sc.h"
44 #include "matrice.h"
45 #include "conversion.h"
46 
47 
48 void derive_new_basis(Pbase base_oldindex, Pbase * base_newindex, entity (*new_entity)(entity))
49 {
50  Pbase pb;
51  entity new_name;
52 
53  for (pb=base_oldindex; pb!=NULL; pb=pb->succ)
54  {
55  new_name = new_entity((entity) pb->var);
56  base_add_dimension(base_newindex, (Variable) new_name);
57  }
58  *base_newindex = base_reversal(*base_newindex);
59 }
60 
61 /* void change_of_base_index(Pbase base_oldindex, Pbase *base_newindex)
62  * change of variable index from base_oldindex to
63  * base_newindex
64 */
65 void change_of_base_index(base_oldindex, base_newindex)
66 Pbase base_oldindex;
67 Pbase *base_newindex;
68 {
69  derive_new_basis(base_oldindex, base_newindex, make_index_prime_entity);
70 }
71 
73 {
74  return make_new_index_entity(old_index, "p");
75 }
76 
78 {
79  return make_index_prime_entity(old_index);
80 }
81 
82 /* Psysteme sc_change_baseindex(Psysteme sc, Pbase base_old, Pbase base_new)
83  * le changement de base d'indice pour sc
84  */
85 Psysteme sc_change_baseindex(sc, base_old, base_new)
86 Psysteme sc;
87 Pbase base_old;
88 Pbase base_new;
89 {
90  Pbase pb1, pb2;
91 
92  for(pb1=base_old,pb2=base_new;pb1!=NULL;pb1=pb1->succ,pb2=pb2->succ)
93  sc_variable_rename(sc,pb1->var,pb2->var);
94  return(sc);
95 }
96 
97 
98 
99 
100 
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,...
Definition: base.c:221
void derive_new_basis(Pbase base_oldindex, Pbase *base_newindex, entity(*new_entity)(entity))
package conversion
void change_of_base_index(Pbase base_oldindex, Pbase *base_newindex)
void change_of_base_index(Pbase base_oldindex, Pbase *base_newindex) change of variable index from ba...
entity make_index_prime_entity(entity old_index)
entity make_index_entity(entity old_index)
Psysteme sc_change_baseindex(Psysteme sc, Pbase base_old, Pbase base_new)
Psysteme sc_change_baseindex(Psysteme sc, Pbase base_old, Pbase base_new) le changement de base d'ind...
entity make_new_index_entity(entity, string)
Definition: variable.c:1851
Psysteme sc_variable_rename(Psysteme s, Variable v_old, Variable v_new)
Psysteme sc_variable_rename(Psysteme s, Variable v_old, Variable v_new): reecriture du systeme s remp...
Definition: sc.c:157
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
#define base_add_dimension(b, v)