Chapter 8.1 : What is a reduction ?



A reduction is a sum of all the elements of a vector.

It can also be a product of all the elements of a vector, but in our case it is a sum.


Mathematicaly it is :

nothing


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;
}