How to add a vector to each row in eigen?

  c++, eigen

I am trying to add a vector to each row in a matrix, but I am getting error.

Here is the code:

Vector3d v = Vector3d(3.0,20.0,0.0);
//std::cout<<shifted_cord<<std::endl;
shifted_cord = shifted_cord.colwise()+v;  //(10,3)

Same thing is done in this, but when I tried, I am getting error.

Error:

Assertion `aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols()' failed.

Can anyone help me with this error?

Source: Windows Questions C++

LEAVE A COMMENT