PIPS
matrix_mul_vect.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "tools.h"
+ Include dependency graph for matrix_mul_vect.c:

Go to the source code of this file.

Functions

void matrix_mul_vect (size_t N, float C[N], float A[N][N], float B[N])
 
int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 18 of file matrix_mul_vect.c.

18  {
19  int i,j,n;
20  float *a,*b,*c;
21  if (argc < 3)
22  {
23  fprintf(stderr, "Usage: %s size data_file\n", argv[0]);
24  return 1;
25  }
26  n = atoi(argv[1]);
27  a=malloc(sizeof(float)*n*n);
28  b=malloc(sizeof(float)*n);
29  c=malloc(sizeof(float)*n);
30 
31  init_data_file(argv[2]);
32  init_data_float(a,n*n);
33  init_data_float(b,n);
35  matrix_mul_vect(n,c,a,b);
36 
37  print_array_float("c",c,n);
38  free(a);
39  free(b);
40  free(c);
41 
42  return 0;
43 }
void * malloc(YYSIZE_T)
void free(void *)
void matrix_mul_vect(size_t N, float C[N], float A[N][N], float B[N])
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
void close_data_file()
Definition: tools.c:48
void print_array_float(const char *name, const float *arr, const unsigned int n)
Definition: tools.c:54
int init_data_float(float *ptr, const unsigned int n)
Definition: tools.c:125
void init_data_file(const char *data_file)
Definition: tools.c:36

References close_data_file(), fprintf(), free(), init_data_file(), init_data_float(), malloc(), matrix_mul_vect(), and print_array_float().

+ Here is the call graph for this function:

◆ matrix_mul_vect()

void matrix_mul_vect ( size_t  N,
float  C[N],
float  A[N][N],
float  B[N] 
)

Definition at line 7 of file matrix_mul_vect.c.

7  {
8  size_t i,j;
9  for (i=0; i<N; i++) {
10  C[i]=0;
11  for (j=0; j<N; j++) {
12  C[i]+=A[i][j] * B[j];
13  }
14  }
15 }
#define B(A)
Definition: iabrev.h:61
Definition: pip__tab.h:25

References B.

Referenced by main().

+ Here is the caller graph for this function: