symforce-org / symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics
https://symforce.org
Apache License 2.0
1.44k stars 147 forks source link

Use a different Rot3.compose(vector) implementation sometimes #101

Open aaron-skydio opened 2 years ago

aaron-skydio commented 2 years ago

Eigen's fancy implementation of this is fewer ops than our current implementation, which is R.to_rotation_matrix() * vector. For rotating vectors, it's only faster if you're only rotating one point through the same rotation. In our code, this means larger expressions are sometimes smaller or larger after CSE with our version vs Eigen's. In particular some potentially heavily used GroupOps on Pose3 are more than 10% faster with Eigen's, but most large expressions like residuals are slower with Eigen's (though not by much, and not all). Seems possible we want to generate some specific functions with the Eigen version and some with our current version, but this would require some work