5.4.3 : Le fichier main.cpp

Développons le main.cpp :

Un peu d'affichage :
1
#include <iostream>


Notre header :
1
#include "hadamard_product.h"


Un main que l'on a déjà vu de nombreuses fois :
1
2
3
4
5
6
7
8
9
10
11
12
int main(int argc, char** argv){
	size_t nbElement(100000000);
	std::vector<float> tabX, tabY, tabRes;
	tabRes.resize(nbElement);
	for(size_t i(0lu); i < nbElement; ++i){
		tabX.push_back(i*19lu%11);
		tabY.push_back(i*27lu%19);
	}
	hadamard_product(tabRes, tabX, tabY);
	std::cout << "x = " << tabX.front() << ", y = " << tabY.front() << ", res = " << tabRes.front() << std::endl;
	return 0;
}


Le fichier main.cpp complet :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/***************************************
	Auteur : Pierre Aubert
	Mail : pierre.aubert@lapp.in2p3.fr
	Licence : CeCILL-C
****************************************/
#include <iostream>
#include "hadamard_product.h"
int main(int argc, char** argv){
	size_t nbElement(100000000);
	std::vector<float> tabX, tabY, tabRes;
	tabRes.resize(nbElement);
	for(size_t i(0lu); i < nbElement; ++i){
		tabX.push_back(i*19lu%11);
		tabY.push_back(i*27lu%19);
	}
	hadamard_product(tabRes, tabX, tabY);
	std::cout << "x = " << tabX.front() << ", y = " << tabY.front() << ", res = " << tabRes.front() << std::endl;
	return 0;
}


Le fichier main.cpp est disponible ici.