◆ dot()

scalar_of_t<Value> boost::simd::dot ( Value const &  x,
Value const &  y 
)

This function object returns the returns the dot product of the two arguments.

Header <boost/simd/function/dot.hpp>
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, 5.0f, 0.5f};
pack_ft qf = {0.0f, 1.0f, 2.0f, 8.0f};
std::cout << "---- simd" << '\n'
<< "<- pf = " << pf << '\n'
<< "<- qf = " << qf << '\n'
<< "-> bs::dot(pf, qf) = " << bs::dot(pf, qf) << '\n';
return 0;
}
Possible output:
---- simd
<- pf = (1, 2, 5, 0.5)
<- qf = (0, 1, 2, 8)
-> bs::dot(pf, qf) = 16