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

Go to the source code of this file.

Functions

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

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 15 of file matrix_mul_matrix.c.

15  {
16 
17  int i,j,n;
18  float *a,*b,*c;
19 
20  if (argc < 3)
21  {
22  fprintf(stderr, "Usage: %s size data_file\n", argv[0]);
23  return 1;
24  }
25  n = atoi(argv[1]);
26  a=malloc(sizeof(float)*4*n*4*n);
27  b=malloc(sizeof(float)*n*4*n*4);
28  c=calloc(n*4*n*4,sizeof(float));
29  init_data_file(argv[2]);
30  init_data_float(a, 4*4*n*n);
31  init_data_float(b, 4*4*n*n);
33 
34  matrix_mul_matrix(n,c,a,b);
35 
36  print_array_float("c",c,n*n);
37 
38  return 0;
39 }
void * malloc(YYSIZE_T)
void matrix_mul_matrix(size_t N, float C[N][N], float A[N][N], float B[N][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(), init_data_file(), init_data_float(), malloc(), matrix_mul_matrix(), and print_array_float().

+ Here is the call graph for this function:

◆ matrix_mul_matrix()

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

Definition at line 6 of file matrix_mul_matrix.c.

6  {
7  size_t i,j,k;
8  for (i=0; i<N; i++) {
9  for (j=0; j<N; j++) {
10  for(k=0;k<N;k++)
11  C[i][j]+=A[i][k] * B[k][j];
12  }
13  }
14 }
#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: