Registered Member
|
Dear all,
It would be great if I can get some information regarding Eigen memory alignment (possibly in combination with Qt).
The above code will give an memory alignment error. The alignment error can be prevented by either uncommenting the EIGEN_MAKE_ALIGNED_OPERATOR_NEW in class Test02 or by removing the QObject inheritance on Test03. Clearly the latter is not an option, as I would like to use Qt methods on the class. The first option (setting EIGEN_MAKE_ALIGNED_OPERATOR_NEW on Test02) would be possible. However, it is unclear to me, from the Eigen documentation, if it is required to set EIGEN_MAKE_ALIGNED_OPERATOR_NEW on all classes that have a member that uses an aligned Eigen object. In other words: if class Test02 has a member of class Test01, which in turn has a member that can be aligned (m_T) does Test02 also need a EIGEN_MAKE_ALIGNED_OPERATOR_NEW? |
Moderator
|
Yes you must have EIGEN_MAKE_ALIGNED_OPERATOR_NEW in the Test02 class, just like Test01 must have it. However, if Test02 would inherit Test01, then Test02 would not need EIGEN_MAKE_ALIGNED_OPERATOR_NEW.
|
Registered Member
|
Thanks - clear answer. I think it would be very useful if the Eigen documentation mentions the requirement of having the EIGEN_MAKE_ALIGNED_OPERATOR_NEW macro also on all classes that indirectly (through composition, like Test02) have alignable Eigen members.
Also, I assume that the QObject inheritance on Test03 causing the memory alignment assertion to fail is pure coincidence? |
Moderator
|
yes, that's the only explanation making sense. |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]