Previous Optimisation of a reduction |
Parent Optimisation of a reduction |
Outline | Next The classical approach |
It can also be a product of all the elements of a vector, but in our case it is a sum.Mathematicaly it is :
In C++ code :
1 2 3 4 5 6 7 |
float reduction(const float * tabValue, long unsigned int nbElement){ float res(0.0f); for(long unsigned int i(0lu); i < nbElement; ++i){ res += tabValue[i]; } return res; } |
Previous Optimisation of a reduction |
Parent Optimisation of a reduction |
Outline | Next The classical approach |