sinpeople Messages: 29 Registered: October 2020 Location: Singapore
Promising Member
Hi folks,
What's the most elegant way to multiply every element of a vector to a scalar? "u=s*v", in which v is the vector, s is a scalar, u is the vector of the same size of v.
The simplest way to do it is to use a for loop. In the STL, there is a transform function. But I have no idea how to adapt it to this case.