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

Go to the source code of this file.

Functions

static void pr_quot (FILE *f, Value a, Value b __attribute__((unused)))
 package matrice More...
 
void matrice_fprint (FILE *f, matrice a, int n, int m)
 void matrice_fprint(File * f, matrice a,n,m): print an (nxm) rational matrix More...
 
void matrice_print (matrice a, int n, int m)
 void matrice_print(matrice a, int n, int m): print an (nxm) rational matrix More...
 
void matrice_fscan (FILE *f, matrice *a, int *n, int *m)
 void matrice_fscan(FILE * f, matrice * a, int * n, int * m): read an (nxm) rational matrix in an ASCII file accessible via file descriptor f; a is allocated as a function of its number of columns and rows, n and m. More...
 

Function Documentation

◆ matrice_fprint()

void matrice_fprint ( FILE *  f,
matrice  a,
int  n,
int  m 
)

void matrice_fprint(File * f, matrice a,n,m): print an (nxm) rational matrix

matrice_io.c

Note: the output format is incompatible with matrice_fscan() row size

Parameters
mNote: the output format is incompatible with matrice_fscan() column size

Definition at line 62 of file matrice_io.c.

67 {
68  int loop1,loop2;
69 
71 
72  (void) fprintf(f,"\n\n");
73 
74  for(loop1=1; loop1<=n; loop1++) {
75  for(loop2=1; loop2<=m; loop2++)
76  pr_quot(f, ACCESS(a,n,loop1,loop2), DENOMINATOR(a));
77  (void) fprintf(f,"\n\n");
78  }
79  (void) fprintf(f," ......denominator = ");
81  fprintf(f, "\n");
82 }
#define value_notzero_p(val)
void fprint_Value(FILE *, Value)
Definition: io.c:42
loop loop1
tiling_sequence.c
#define DENOMINATOR(matrix)
int DENOMINATEUR(matrix): acces au denominateur global d'une matrice matrix La combinaison *(&()) est...
Definition: matrice-local.h:93
#define ACCESS(matrix, column, i, j)
Macros d'acces aux elements d'une matrice.
Definition: matrice-local.h:86
static void pr_quot(FILE *f, Value a, Value b __attribute__((unused)))
package matrice
Definition: matrice_io.c:47
#define assert(ex)
Definition: newgen_assert.h:41
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References ACCESS, assert, DENOMINATOR, f(), fprint_Value(), fprintf(), loop1, pr_quot(), and value_notzero_p.

Referenced by average_probability_matrix(), hyperplane(), interactive_partitioning_matrix(), local_tile_constraints(), make_tile_constraints(), matrice_print(), parallel_tiling(), partial_broadcast_coefficients(), prototype_dimension(), sc_image_computation(), tile_hyperplane_constraints(), tile_membership(), tile_membership_constraints(), tiling_transformation(), transformer_equality_fix_point(), and unstructured_to_complexity().

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

◆ matrice_fscan()

void matrice_fscan ( FILE *  f,
matrice a,
int n,
int m 
)

void matrice_fscan(FILE * f, matrice * a, int * n, int * m): read an (nxm) rational matrix in an ASCII file accessible via file descriptor f; a is allocated as a function of its number of columns and rows, n and m.

Format:

n m denominator a[1,1] a[1,2] ... a[1,m] a[2,1] ... a[2,m] ... a[n,m]

After the two dimensions and the global denominator, the matrix as usually displayed, line by line. Line feed can be used anywhere. Example for a (2x3) integer matrix: 2 3 1 1 2 3 4 5 6 row size

number of read elements

read dimensions

allocate a

read denominator

necessaires pour eviter les divisions par zero

pour "normaliser" un peu les representations

Parameters
mFormat:

n m denominator a[1,1] a[1,2] ... a[1,m] a[2,1] ... a[2,m] ... a[n,m]

After the two dimensions and the global denominator, the matrix as usually displayed, line by line. Line feed can be used anywhere. Example for a (2x3) integer matrix: 2 3 1 1 2 3 4 5 6 column size

Definition at line 115 of file matrice_io.c.

120 {
121  int r;
122  int c;
123 
124  /* number of read elements */
125  int n_read;
126 
127  /* read dimensions */
128  n_read = fscanf(f,"%d%d", n, m);
129  assert(n_read==2);
130  assert(1 <= *n && 1 <= *m);
131 
132  /* allocate a */
133  *a = matrice_new(*n,*m);
134 
135  /* read denominator */
136  n_read = fscan_Value(f,&(DENOMINATOR(*a)));
137  assert(n_read == 1);
138  /* necessaires pour eviter les divisions par zero */
140  /* pour "normaliser" un peu les representations */
142 
143  for(r = 1; r <= *n; r++)
144  for(c = 1; c <= *m; c++) {
145  n_read = fscan_Value(f,&ACCESS(*a,*n,r,c));
146  assert(n_read == 1);
147  }
148 }
#define value_pos_p(val)
int fscan_Value(FILE *, Value *)
Definition: io.c:58
#define matrice_new(n, m)
Allocation et desallocation d'une matrice.
Definition: matrice-local.h:77

References ACCESS, assert, DENOMINATOR, f(), fscan_Value(), matrice_new, value_notzero_p, and value_pos_p.

Referenced by unimodular().

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

◆ matrice_print()

void matrice_print ( matrice  a,
int  n,
int  m 
)

void matrice_print(matrice a, int n, int m): print an (nxm) rational matrix

Note: the output format is incompatible with matrice_fscan() this should be implemented as a macro, but it's a function for dbx's sake row size

Parameters
mNote: the output format is incompatible with matrice_fscan() this should be implemented as a macro, but it's a function for dbx's sake column size

Definition at line 90 of file matrice_io.c.

94 {
95  matrice_fprint(stdout,a,n,m);
96 }
void matrice_fprint(FILE *f, matrice a, int n, int m)
void matrice_fprint(File * f, matrice a,n,m): print an (nxm) rational matrix
Definition: matrice_io.c:62

References matrice_fprint().

Referenced by matrice_smith().

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

◆ pr_quot()

static void pr_quot ( FILE *  f,
Value  a,
Value b   __attribute__(unused) 
)
static

package matrice

void pr_quot(FILE * f, int a, int b): print quotient a/b in a sensible way, i.e. add a space in front of positive number to compensate for the minus sign of negative number

FI: a quoi sert le parametre b? A quoi sert la variable d? =>ARGSUSED

Definition at line 47 of file matrice_io.c.

50 {
51  if (value_pos_p(a))
52  fprintf(f, " ");
53  fprintf(f, " ");
54  fprint_Value(f, a);
55  fprintf(f, " ");
56 }

References f(), fprint_Value(), fprintf(), and value_pos_p.

Referenced by matrice_fprint().

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