Registered Member
|
Hi all,
I am evaluation eigen for future project. One simple question that I cannot figure out is how one can fill a matrix give an array of double (in column/row major order). Any pointer is appreciated. |
Registered Member
|
Use the Map class to map your existing double* array as a Eigen expression.
http://eigen.tuxfamily.org/dox/classEigen_1_1Map.html EDIT: hm OK the documentation there isn't too friendly so have a look at the tutorial: http://eigen.tuxfamily.org/dox/TutorialCore.html (search for "Map" in that page)
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered Member
|
Nice, that helps.
One more follow up question. Suppose that the memory buffer is not cache aligned with the eigen standard, would the vectorisation still be performed? Thanks. |
Registered Member
|
For dynamic-size expressions (for example Map<MatrixXf>), yes. Eigen will then, at runtime, do the first few scalars separately until the first 16-byte-aligned location, and will continue with SIMD packets from there on.
For fixed-size expressions (for example Map<Matrix4f>), no. If you happen to know that the pointer is 16-byte aligned, then, with the development branch (not Eigen 2.0) you can tell that to Eigen: Map<Matrix4f, Aligned>.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]