faster implementation of SO3 random - #105
Conversation
bf38e2c to
cce03fc
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## devel #105 +/- ##
==========================================
- Coverage 98.04% 97.89% -0.16%
==========================================
Files 32 32
Lines 1025 1044 +19
==========================================
+ Hits 1005 1022 +17
- Misses 20 22 +2 🚀 New features to boost your workflow:
|
|
Hi @dllu, |
|
Hey, sorry I am a bit late for this one. Thoughts: yes, faster is always good. Also, the plots show a perfect match of performance. Mind that it is important to not fall back again to the issues discussed in #68 . So OK also in this regard. For me it is OK to merge. |
joansola
left a comment
There was a problem hiding this comment.
I already gave my support for this PR on the comments.
Following my comment on sophus I suspected that Marsaglia's rejection sampling is faster than the more elegant method that is currently being used.
So I implemented this method.
Below are some benchmarks. Please check out my branch and test on your machine and see if your experience matches mine. It seems we can get about 20% more performance.
I am confused why the same code for generating a random quaternion is duplicated in
SE3_base.hand inSO3_base.h. If anyone has ideas for refactoring it so that it is no longer duplicated, I will be happy to hear.Benchmarks:
Benchmark code:
clang++ -O3 -I../manif/include -I/usr/include/eigen3 -I../manif/external/lt -o test test.cppclang++ -O3 -I../manif/include -I/usr/include/eigen3 -I../manif/external/lt -o test test.cppg++ -O3 -I../manif/include -I/usr/include/eigen3 -I../manif/external/lt -o test test.cppg++ -O3 -I../manif/include -I/usr/include/eigen3 -I../manif/external/lt -o test test.cppCompilers used:
Test System
Randomness tests
I used a variant of qqiu's MATLAB script.
Because I am using a different
quat2axangimplementation, mine outputs angle in [0, 2pi] rather than [-pi, pi] like @qqfly 's. But it does not make a difference.Top: devel branch; bottom: my branch. Results look identical.