• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1namespace Eigen {
2
3/** \eigenManualPage TopicFixedSizeVectorizable Fixed-size vectorizable Eigen objects
4
5The goal of this page is to explain what we mean by "fixed-size vectorizable".
6
7\section summary Executive Summary
8
9An Eigen object is called "fixed-size vectorizable" if it has fixed size and that size is a multiple of 16 bytes.
10
11Examples include:
12\li Eigen::Vector2d
13\li Eigen::Vector4d
14\li Eigen::Vector4f
15\li Eigen::Matrix2d
16\li Eigen::Matrix2f
17\li Eigen::Matrix4d
18\li Eigen::Matrix4f
19\li Eigen::Affine3d
20\li Eigen::Affine3f
21\li Eigen::Quaterniond
22\li Eigen::Quaternionf
23
24\section explanation Explanation
25
26First, "fixed-size" should be clear: an Eigen object has fixed size if its number of rows and its number of columns are fixed at compile-time. So for example Matrix3f has fixed size, but MatrixXf doesn't (the opposite of fixed-size is dynamic-size).
27
28The array of coefficients of a fixed-size Eigen object is a plain "static array", it is not dynamically allocated. For example, the data behind a Matrix4f is just a "float array[16]".
29
30Fixed-size objects are typically very small, which means that we want to handle them with zero runtime overhead -- both in terms of memory usage and of speed.
31
32Now, vectorization (both SSE and AltiVec) works with 128-bit packets. Moreover, for performance reasons, these packets need to be have 128-bit alignment.
33
34So it turns out that the only way that fixed-size Eigen objects can be vectorized, is if their size is a multiple of 128 bits, or 16 bytes. Eigen will then request 16-byte alignment for these objects, and henceforth rely on these objects being aligned so no runtime check for alignment is performed.
35
36*/
37
38}
39