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

General type for passing any matrix by reference

Tags: None
(comma "," separated)
zoharl
Registered Member
Posts
55
Karma
0
OS
Hi,

Is there a joker type that can accept any kind of a dense matrix?
Maybe a template definition?
Maybe to include also vectors, such that .cols() == 1?

Code: Select all
void f(Joker &A)
{
  cout << A.rows() << ", " << A.cols() << endl;
}

void main()
{
  MatrixXd Ax;
  Matrix4d A4;
  Matrix3d A3;
  f(Ax);
  f(A4);
  f(A3);
}
zoharl
Registered Member
Posts
55
Karma
0
OS
It seems that

Code: Select all
template<class Joker>
void f(Joker &A)
...


does the trick for the general case, so I need to rethink in what case I had a problem (maybe separating between vectors and matrices?).


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot]