Hi Barak
If you are to touch the RigidBody code, I'd suggest to rewrite it completely with eigen, which would spare you these troubles (I guess). Also, check my code in core/internal/tunneler_helpers.h, and the two classes that use it, RigidBodyUmbrella and RigidBodyTunneler. I needed to reimplement the coordinate methods provided by RigidBody (local/global coords, rotation, translation etc, among which your get_reference_frame() ). This was because the reference frame returned by RigidBody::get_reference_frame is not consistent, but an arbitrary reflection can happen (see IMP issue #773). I reimplemented it with eigen, so this might be of interest to you.

For the particular case you mention, you'd want to cache q.matrix() if q is the Eigen::Quaternion, and use that rotation matrix to do the rotations. As the Eigen doc states (Eigen::QuaternionBase doc),

"If the quaternion is used to rotate several points (>1) then it is much more efficient to first convert it to a 3x3 Matrix. Comparison of the operation cost for n transformations:

"

Y


Le 18/06/14 21:14, Barak Raveh a écrit :
Hi, right now RigidBody::get_reference_frame() is a common yet expensive operation (from profilng), especially within scores. The reason seems to be that IMP saves the quaternion, but not the rotation matrix. 

Would it make sense to save a cache of the rotation matrix that would update if needed? Or is it possibly that memory cost would be too high?


--
Barak


_______________________________________________
IMP-dev mailing list
IMP-dev@salilab.org
https://salilab.org/mailman/listinfo/imp-dev