Version 1 (modified by sylvain.joyeux, 10 years ago) (diff) |
---|

# Using Eigen types in Rock

Rock is based extensively on Eigen types.

In libraries, the normal Eigen rules apply

In components, there are two constraints:

- Eigen types should not have any alignment requirements
- they should be registered as opaque types in oroGen

## 1. Removing alignment requirements from Eigen types

Eigen's fixed-size Matrix type can be marked as non-aligned (and therefore not vectorized). Benchmarking showed that for small vectors (< 10 elements) it has no negative impact (and even has a small positive impact).

This is done by providing the fourth template parameter as Eigen::DontAlign. For instance, Vector4 is defined

In Rock, these "dont't align" types are defined in the base/types package, in base/eigen.h. We are using the same typedefs as Eigen itself, but put inside the base:: namespace.

For instance, the non-aligned version of Eigen::Vector4d is base::Vector4d.

**Using the base variants of the types is encouraged, but not mandatory, in rock libraries.**

**In Eigen 2.x, one cannot do that for Quaternion. Eigen 3.x does have that ability, but is not yet integrated in Rock**