Line |
Branch |
Exec |
Source |
1 |
|
|
/*************************************** |
2 |
|
|
Auteur : Pierre Aubert |
3 |
|
|
Mail : pierre.aubert@lapp.in2p3.fr |
4 |
|
|
Licence : CeCILL-C |
5 |
|
|
****************************************/ |
6 |
|
|
|
7 |
|
|
|
8 |
|
|
#include "hadamard_product.h" |
9 |
|
|
|
10 |
|
|
#define FLOAT_VECTOR_ALIGNEMENT 64 |
11 |
|
|
|
12 |
|
|
///Do the Hadamard product |
13 |
|
|
/** @param[out] ptabResult : table of results of tabX*tabY |
14 |
|
|
* @param ptabX : input table |
15 |
|
|
* @param ptabY : input table |
16 |
|
|
* @param nbElement : number of elements in the tables |
17 |
|
|
*/ |
18 |
|
✗ |
void hadamard_product(float* __restrict__ ptabResult, const float* __restrict__ ptabX, const float* __restrict__ ptabY, long unsigned int nbElement){ |
19 |
|
✗ |
const float* tabX = (const float*)__builtin_assume_aligned(ptabX, FLOAT_VECTOR_ALIGNEMENT); |
20 |
|
✗ |
const float* tabY = (const float*)__builtin_assume_aligned(ptabY, FLOAT_VECTOR_ALIGNEMENT); |
21 |
|
✗ |
float* tabResult = (float*)__builtin_assume_aligned(ptabResult, FLOAT_VECTOR_ALIGNEMENT); |
22 |
|
|
|
23 |
|
✗ |
for(long unsigned int i(0lu); i < nbElement; ++i){ |
24 |
|
✗ |
tabResult[i] = tabX[i]*tabY[i]; |
25 |
|
|
} |
26 |
|
|
} |
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|