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

Go to the source code of this file.

Functions

void dscal_r (int n, float da, float dx[n])
 
int main (int argc, char *argv[])
 

Function Documentation

◆ dscal_r()

void dscal_r ( int  n,
float  da,
float  dx[n] 
)

Definition at line 5 of file dscal_r.c.

6 {
7  int i;
8  for (i = 0; i < n; i++)
9  dx[i] = da*dx[i];
10 }

Referenced by main().

+ Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 12 of file dscal_r.c.

13 {
14  int n;
15  float *dx;
16  int i;
17 
18  if (argc < 3)
19  {
20  fprintf(stderr, "Usage: %s size data_file\n", argv[0]);
21  return 1;
22  }
23  n = atoi(argv[1]);
24  dx = (float*) malloc(n*sizeof(float));
25  init_data_file(argv[2]);
26  init_data_float(dx, n);
28  dscal_r(n,42.,dx);
29  print_array_float("res", dx, n);
30  return 0;
31 }
void dscal_r(int n, float da, float dx[n])
Definition: dscal_r.c:5
void * malloc(YYSIZE_T)
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(), dscal_r(), fprintf(), init_data_file(), init_data_float(), malloc(), and print_array_float().

+ Here is the call graph for this function: