I am implementing a function member of a derived class (declared as virtual in the base class). One of the arguments is a vectorXd and it is where the result of an operation will be stored.
I read the "Writing Functions Taking Eigen Types as Parameters" (http://eigen.tuxfamily.org/dox/TopicFunctionTakingEigenTypes.html) and their hack relies on templated functions, focusing in a generic Eigen object as possible parameter. In my case I don't think it'll work because it seems that you can't mix virtual and template.
On the other hand, I know that my argument is always going to be of type VectorXd, and I can even resize it to the right size before going into the function so that no resizing is necessary inside the function. I am trying the approach of passing the vector by reference as a const and using const_cast to be able to make the modifications I need, but I still get a linking error:
error LNK2001: unresolved external symbol "public: virtual void __thiscall problem::f(class method *,class Eigen::Matrix const &,class Eigen::Matrix const &)" (?f@problem@@UAEXPAVmethod@@ABV?$Matrix@N$0?0$00$0A@$0?0$00@Eigen@@1@Z)
Here, 'problem' is the base class, 'f' is the function, and 'method' is another class (I need an object of that type inside my function too).
In the definition of problem I have:
virtual void f(method *m, const Eigen::VectorXd &x, Eigen::VectorXd const &y);
In the definition of derived:problem I have:
void f(method *m, const Eigen::VectorXd &x, Eigen::VectorXd const &y) {...};
'y' is where I need to store the result. Any suggestions on how to achieve this?
Thanks in advanced.