It is not difficult to implement element-wise product in C++:
vector<float> a_array;
vector<float> b_array;
vector<float> c_array;
vector<float> dot_array;
....
for(int i=0; i<a_array.size(); i++)
{
float temp;
temp = a_array[i]*b_array[i]*c_array[i];
dot_array[i] = temp;
}
This is a very simple implementation, and I am wondering whether there are more efficient algorithms already available in STL. Thanks!
std::transformcan be used to multiply two vectors:There is no similar standard algorithm with more than two input sequences.