Registered Member
|
I am having some very strange behaviour with multiplying Eigen VectorXf objects. So, I have something like:
The idea is that I would get the element wise squaring of the vector. So, the gradient vector is fine and contains the correct values but the grad_2 object is completely nonsensical (or computes some other unexpected vector product for me) and basically just contains noise. Am I doing something terribly wrong here? I would like to do an element wise multiplication between two vectors. Thanks, Luca |
Moderator
|
You are multiplying a Nx1 matrix with a Nx1 matrix which is undefined in terms of matrix algebra. grad_2 = gradient.cwiseAbs2() will do the job.
See http://eigen.tuxfamily.org/dox-devel/gr ... Class.html for more on this topic. |
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]