PIPS
scanning_base.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "misc.h"
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "sc.h"
#include "matrice.h"
#include "hyperplane.h"
+ Include dependency graph for scanning_base.c:

Go to the source code of this file.

Functions

void scanning_base_hyperplane (h, int n, matrice G)
 package hyperplane. More...
 
void base_G_h1_unnull (h, int n, matrice G)
 oid base_G_h1_unnull(int h[],int n,matrice G)
More...
 

Function Documentation

◆ base_G_h1_unnull()

void base_G_h1_unnull ( ,
int  n,
matrice  G 
)

oid base_G_h1_unnull(int h[],int n,matrice G)

determinant of Ui and Ui-1

computation of matrix U

initialisation

computation of Xi,Yi / Xi.det(Ui-1) - Yi.hi = GCD(det(Ui-1),hi)

make Ui - the i-th line: U[i,1]=h[i-1],U[i,2..n-1] =0,U[i,n] = Xi

->i-1

the i-th column:U[1..n-1] = Yi/det(Ui-1) . h

-> ->

divide U1 par GCD(h)

computation of matrix G

Definition at line 94 of file scanning_base.c.

98 {
99  matrice U = matrice_new(n,n);
100  matrice G1 = matrice_new(n,n);
101  Value det_Ui = VALUE_ONE;
102  Value det_Ui1 = VALUE_ZERO; /* determinant of Ui and Ui-1*/
103  Value Xi,Yi;
104  int i,j;
105  Value r;
106 
107  /* computation of matrix U */
108  assert(n>0);
109  assert(h[0]!=0);
110  /* initialisation */
111  matrice_nulle(U,n,n);
112  ACCESS(U,n,1,1) = h[0];
113  det_Ui1 = h[0];
114 
115  for(i=2; i<=n; i++){
116  /* computation of Xi,Yi / Xi.det(Ui-1) - Yi.hi = GCD(det(Ui-1),hi) */
117  det_Ui = bezout_grl(det_Ui1,h[i-1],&Xi,&Yi);
118  if (i ==2 || i%2 != 0)
119  value_oppose(Yi);
120  /* make Ui - the i-th line: U[i,1]=h[i-1],U[i,2..n-1] =0,U[i,n] = Xi*/
121  ACCESS(U,n,i,1) = h[i-1];
122  ACCESS(U,n,i,i) = Xi;
123  /* ->i-1 */
124  /* the i-th column:U[1..n-1] = Yi/det(Ui-1) . h */
125  for (j=1; j<=i-1; j++){
126  r = value_div(h[j-1],det_Ui1);
127  ACCESS(U,n,j,i) = value_mult(Yi,r);
128  }
129  det_Ui1 = det_Ui;
130  }
131  for (i=1; i<=n; i++)
132  /* -> ->*/
133  /* divide U1 par GCD(h) */
134  value_division(ACCESS(U,n,i,1),det_Ui);
135 
136  /* computation of matrix G */
138  matrice_transpose(G1,G,n,n);
139 }
#define VALUE_ZERO
#define value_oppose(ref)
int Value
#define value_division(ref, val)
#define VALUE_ONE
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
#define value_div(v1, v2)
Value bezout_grl(Value, Value, Value *, Value *)
int bezout_grl(int a, int b, int *x, int *y): calcule x et y, les deux entiers quelconcs qui verifien...
Definition: pgcd.c:324
#define ACCESS(matrix, column, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrice-local.h:86
#define matrice_new(n, m)
Allocation et desallocation d'une matrice.
Definition: matrice-local.h:77
Value * matrice
package matrice
Definition: matrice-local.h:71
void matrice_general_inversion(matrice a, matrice inv_a, int n)
void matrice_general_inversion(matrice a; matrice inv_a; int n) calcul de l'inversion du matrice gene...
Definition: inversion.c:222
void matrice_transpose(matrice a, matrice a_t, int n, int m)
package matrice
Definition: matrice.c:48
void matrice_nulle(matrice Z, int n, int m)
void matrice_nulle(matrice Z, int n, int m): Initialisation de la matrice Z a la valeur matrice nulle
Definition: matrice.c:311
#define assert(ex)
Definition: newgen_assert.h:41
#define G(j, a, b)
maybe most of them should be functions?

References ACCESS, assert, bezout_grl(), G, matrice_general_inversion(), matrice_new, matrice_nulle(), matrice_transpose(), value_div, value_division, value_mult, VALUE_ONE, value_oppose, and VALUE_ZERO.

Referenced by scanning_base_hyperplane().

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

◆ scanning_base_hyperplane()

void scanning_base_hyperplane ( ,
int  n,
matrice  G 
)

package hyperplane.

Build a change of basis matrix G compatible with a hyperplane direction h include <sys/stdtypes.h> for debug with dbmalloc include "stdlib.h" void scanning_base_hyperplane(int h[],int n,matrice U) compute the matrix U : -> -> -> U1 = h (U1 the first column of U) determinant(U) = +(/-)1.

Let G the scanning basis, the relation between U and T is -1 T
G = (U ) the parameters of the function are:

int h[] : hyperplan direction -— input int n : iteration dimension -— input matrice G : matrix -— output

search the first k / h[k]!=0

permution de h[0] et h[k]

Definition at line 69 of file scanning_base.c.

73 {
74  int k=1;
75 
76  if (value_zero_p(h[0])){
77  /* search the first k / h[k]!=0 */
78  while(k<n && value_zero_p(h[k]))
79  k++;
80  if (k==n) user_error("scanning_base_hyperplane", "h is null vector\n");
81  else{ /* permution de h[0] et h[k] */
82  h[0] = h[k];
83  h[k] = VALUE_ZERO;
84  base_G_h1_unnull(h,n,G);
85  matrice_swap_rows(G,n,n,1,k+1);
86  }
87  }
88  else
89  base_G_h1_unnull(h,n,G);
90 }
#define value_zero_p(val)
void matrice_swap_rows(matrice a, int n, int m, int r1, int r2)
void matrice_swap_rows(matrice a, int n, int m, int r1, int r2): exchange rows r1 and r2 of an (nxm) ...
Definition: matrice.c:230
#define user_error(fn,...)
Definition: misc-local.h:265
void base_G_h1_unnull(h, int n, matrice G)
oid base_G_h1_unnull(int h[],int n,matrice G)
Definition: scanning_base.c:94

References base_G_h1_unnull(), G, matrice_swap_rows(), user_error, VALUE_ZERO, and value_zero_p.

+ Here is the call graph for this function: