/*************************************** Auteur : Pierre Aubert Mail : aubertp7@gmail.com Licence : CeCILL-C ****************************************/ //some doc at : https://en.cppreference.com/w/cpp/header/algorithm #include //Some doc at : https://en.cppreference.com/w/cpp/header/execution #include #include "barycenter2d.h" ///Do a classical barycenter /** @param[out] res : result * @param tabX : talbe of x values * @param tabY : talbe of y values * @param nbElement : number of elements in the tables */ void barycenter2d(float & res, const float* tabX, const float* tabY, size_t nbElement){ res = std::transform_reduce(std::execution::unseq, tabX, tabX + nbElement, tabY, 0.0f, std::plus(), [](float xi, float yi){ return xi*yi; }); res /= (float)nbElement; }