◆ cumsum()

Value boost::simd::cumsum ( Value const &  x)

This function object returns the cumulate sum of the argument elements.

Header <boost/simd/function/cumsum.hpp>
See also
cumprod, cummin, cummax
Example:
#include <boost/simd/pack.hpp>
#include <boost/simd/reduction.hpp>
#include <iostream>
namespace bs = boost::simd;
using pack_ft = bs::pack<float, 4>;
int main() {
pack_ft pf = {1.0f, 2.0f, -1.0f, 0.5f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "-> bs::cumsum(pf) = " << bs::cumsum(pf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, -1, 0.5)
-> bs::cumsum(pf) = (1, 3, 2, 2.5)