This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to receive RowXpr/ColXpr arguments in function

Tags: None
(comma "," separated)
someguy
Registered Member
Posts
14
Karma
0
Hi,

I am trying to write a function that can receive either ColXpr or RowXpr objects by reference. How can I declare such function? When I use the code below, I get a message:
error: no instance of function template "MyFunct" matches the argument list

Thanks

P.S. I'm using Eigen 2.0.15 (sorry, I cannot use use Eigen 3)

Code: Select all
template <typename ScalarType>
ScalarType MyFunct(Eigen::Matrix<ScalarType, Eigen::Dynamic, Eigen::Dynamic>::Block &Values)
{
...
}

...
Eigen::Matrix<ScalarType, Eigen::Dynamic, Eigen::Dynamic> a_matrix;
...
ScalarType result = MyFunct<ScalarType>(a_matrix.row(i));
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
simply template it to accept any eigen expression:

Code: Select all
template<typename Derived> typename Derived::Scalar MyFunct(const Eigen::MatrixBase<Derived>& Values);
someguy
Registered Member
Posts
14
Karma
0
ggael wrote:simply template it to accept any eigen expression:

Code: Select all
template<typename Derived> typename Derived::Scalar MyFunct(const Eigen::MatrixBase<Derived>& Values);


Thanks


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft