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

Confusion about functions with MatrixBase inputs

Tags: None
(comma "," separated)
rbot
Registered Member
Posts
2
Karma
0
Hallo everybody!
I'm writing a little library using Eigen and most of my functions take Eigen matrices as input. As I discovered while programming, a method using Eigen::Matrix as input type, does not accept the results of general expression, e.g. matrix blocks, as arguments; you need to use MatrixBase<Derived>.

However, I'm confused: some methods only make sense when the matrix has some specific dimensions, e.g. 3x3 or 3x1.

If I just write MatrixBase<Derived>, I have no way of specifying that the argument must be 3x3 or 3x1 or whatever.

Is there I way I can do it?


Thanks!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Within Eigen, we use static assertion for that purpose. Other options include enable_if mechanism or using Eigen::Ref<Matrix<double,3,3> > (http://eigen.tuxfamily.org/dox-devel/cl ... _1Ref.html).
rbot
Registered Member
Posts
2
Karma
0
Great! Now I'll try, but apparently my problem is solved. Thanks!


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]