Registered Member
|
I will let my code do the talking
|
Moderator
|
What are you trying to achieve?
A Block<T> expression defines a reference to a sub expression of type T. If you want "mat" to represent an abstract expression, then use "auto mat = ...", if you want the actual values use auto 'mat = (....).eval()' or, in your case, "Matrix<double,Dynamic,1> mat = ....". Finally, since you are taking columns, better let Eigen's know at compile time: matrix.col(dim).tail(rows-1) - matrix.col(dim).head(rows-1) |
Registered Member
|
I'm just trying to figure out how to return the difference of the columns of a generic matrix. So I would like to take in a MatrixBase<Derived> and return the same (with 1 less row obviously). I am having trouble with converting from Eigen::CwiseBinaryOp to Eigen::MatrixBase or Eigen::Block, whatever it may be.
I'm basically trying to mimic this function http://www.mathworks.com/help/matlab/re ... n_loc_drop |
Moderator
|
So I guess you want to return an expression and not the evaluated expression. If you can use C++11 (or even better 14) then better use "auto", otherwise the answer is in the error message:
CwiseBinaryOp<internal::scalar_difference_op<double>, const Block<Derived, Dynamic, Dynamic>, const Eigen::Block<Derived, Dynamic, Dynamic> > |
Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]