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

problem with 2D vector typedef

Tags: None
(comma "," separated)
kfriddile
Registered Member
Posts
23
Karma
0

problem with 2D vector typedef

Mon Mar 29, 2010 9:12 pm
I've defined a two-dimensional vector type using my own scalar type like so:

typedef Eigen::Matrix<Real, 2, 1> Vector2;

I am having trouble constructing an object of this type using two Real objects, likely because there doesn't appear to be a constructor of the form "Matrix (const Scalar &x, const Scalar &y)" according to http://eigen.tuxfamily.org/dox/classEig ... atrix.html ...am I missing something obvious? This works fine for a similar three-dimensional vector typedef since the necessary constructor is present.
User avatar
bjacob
Registered Member
Posts
658
Karma
3

Re: problem with 2D vector typedef

Tue Mar 30, 2010 12:10 am
OK, this is a limitation of Eigen 2.0 that thas been overcome in the development branch.

In Eigen 2.0, the 2D vector constructor taking 2 scalars works only with float and double. The reason for that is the conflict with the MatrixXd(int rows, int cols) constructor.

Two possibilities:
- either you switch to the development branch
- or you define a EIGEN_MATRIX_PLUGIN file where you implement the 2d vector constructors for the types you're interested in.

For a general plugins howto see this recent thread:
viewtopic.php?f=74&t=86581


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]