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

Alignment of generic (eigen independent) templates

Tags: None
(comma "," separated)
catskul
Registered Member
Posts
2
Karma
0
OS
I've come across the problem that I've made some templates that are meant to be used independently from eigen (i.e. cannot depend on eigen) that are none-the-less in need of eigen alignment when used with eigen types to conform to stated eigen alignment rules.

Is there any known solution to this? In some cases I can change some of the data members to references to avoid the problem, but others probably not.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
you can use types that does not require alignment, like:

Eigen::Matrix<double,4,1,Eigen::DontAlign> instead of Eigen::Vector4d... The downside is that you lost vectorization for these precise objects.
catskul
Registered Member
Posts
2
Karma
0
OS
Do they play well with types are aligned? For instance, can I do the following safely?:

Eigen::Matrix<double,4,1,Eigen::DontAlign> foo;
Eigen::Matrix<double,4,1> bar;

foo.dot( bar );
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
sure, they are fully compatible.


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], q.ignora, watchstar