Registered Member
|
Dear All,
the process I seek to speed up using SSE is applying a 3D linear transformation to a set of 3D points. Future processing of results is no concern (it is out of my control in a project, happens infrequently and using a macro language). The question is how to arrange data to get max speed? I guess I'll have to pad the points with 4th coordinate to get alignment and multiply 4D points one by one or make a matrix from points to use matrix multiplication, but given significant and not yet documented changes in version 3 I beg the collective mind of the forum to share some wisdom (as opposed to "Use the search, Luke!" universal advice). |
Registered Member
|
Indeed, the padding with 4th coord is one option. The unsupported AlignedVector3 class in eigen3 might help here.
Another option might be to store all your 3D vectors as the columns of a single 3xN row-major matrix (i.e. Matrix<float,3,Dynamic,RowMajor> ), so that in memory all the x-coords would be contiguous, followed by all the y-coords, and finally all the z-coords. Then you can apply your transformation (a 3x3 matrix) to all your vectors at once with a single matrix multiply. This works already with eigen2. Yet another option with eigen 3.x will be Matrix<ArrayXf, 3, 1> i.e. the strucure-of-arrays approach, which is really equivalent to the previous solution, only with a more natural syntax. But it's unlikely to become well optimized before eigen 3.1.
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: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]