Pit Falls

From Eigen
Revision as of 16:25, 17 September 2009 by Andy.somerville (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Pit Falls

Alignment Issues (crash)

Eigen has made some trade offs in favor of performance that have some costs in the use of the library.

Specifically there are a class of pit-falls related to alignment that are important to understand before choosing Eigen.

You can read more about them here but in short they are:


Header Issues (failure to compile)

Eigen has split the functionality of individual types across header files which can cause confusion. Just because you can instantiate a type does not mean that you have access to all of it's functionality. To concisely illustrate the issue consider the following:

#include <Eigen/Core>
int main()
{
	Eigen::Vector3d vec1, vec2;
	vec1.cross( vec2 );
	return 0;
}

Compiling this will an error in line 5 (vec1.cross...):

undefined reference to `Eigen::Matrix<double, 3, 1, 2, 3, 1> Eigen::MatrixBase<Eigen::Matrix<double, 3, 1, 2, 3, 1> >::cross<Eigen::Matrix<double, 3, 1, 2, 3, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, 3, 1, 2, 3, 1> > const&) const'

...because the cross product functionality is in another header(Eigen/Geometry).