Granted that v
, a
are Eigen::VectorXd
vectors with n dimensions, I would like to make the following piece-wise operations:
- The piece-wise multiplication of
v
bya
, i.e., the vector(a[1]*v[1], ..., a[n]*v[n])
, and - The piece-wise square of
v
, i.e., the vector(v[1]*v[1], ..., v[n]*v[n])
.
Does Eigen
provide methods for the above operations, or do I need to implement them manually? There are certainly very simple, but I would like them to run as fast as possible.