Previous The barycentre_vectorize.h |
Parent The vectorization of barycentre |
Outline | Next The main_barycentre_vectorize.cpp |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#include "barycentre_vectorize.h" ///Compute the barycentre of the x,y,a tables /** @param[out] gx : barycentre on X axis * @param[out] gy : barycentre on Y axis * @param ptabX : coordinates on X axis * @param ptabY : coordinates on Y axis * @param ptabA : signal amplitude * @param nbElement : number of elements of the input tables */ void barycentre(float & gx, float & gy, const float * __restrict__ ptabX, const float* __restrict__ ptabY, const float* __restrict__ ptabA, long unsigned int nbElement){ const float* tabX = (const float*)__builtin_assume_aligned(ptabX, VECTOR_ALIGNEMENT); const float* tabY = (const float*)__builtin_assume_aligned(ptabY, VECTOR_ALIGNEMENT); const float* tabA = (const float*)__builtin_assume_aligned(ptabA, VECTOR_ALIGNEMENT); gx = 0.0f; gy = 0.0f; for(long unsigned int i(0lu); i < nbElement; ++i){ gx += tabX[i]*tabA[i]; gy += tabY[i]*tabA[i]; } gx /= (float)nbElement; gy /= (float)nbElement; } |
Previous The barycentre_vectorize.h |
Parent The vectorization of barycentre |
Outline | Next The main_barycentre_vectorize.cpp |