perf: compute Twist3.Ad() directly instead of via a throwaway SE3 - #211
Open
petercorke wants to merge 1 commit into
Open
perf: compute Twist3.Ad() directly instead of via a throwaway SE3#211petercorke wants to merge 1 commit into
petercorke wants to merge 1 commit into
Conversation
Ad() was self.SE3().Ad() -- constructs a full validated SE3 object just to immediately extract its array and discard the object. Computes the same result directly (trexp then tr2adjoint, skipping the SE3 constructor/validation overhead): bit-identical output, ~1.4x faster. No existing test covered Ad() at all; added one first (hand-verified pure-rotation and pure-translation cases, plus a cross-check against SE3.Ad() over 20 random transforms) and confirmed it passes unchanged against both the old and new implementation.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Twist3.Ad()wasreturn self.SE3().Ad()-- builds a full, validatedSE3object purely to immediately extract its array inside.Ad()and discard the object.smb.tr2adjoint(smb.trexp(self.S, check=False)). Same underlying math (trexpthentr2adjoint), just without the intermediate pose-object construction.Ad()at all. Added one first, with hand-verified ground truth (not derived fromAd()itself) for pure-rotation (block-diagonal[[R,0],[0,R]]) and pure-translation (skew(t)coupling) cases, plus a cross-check againstSE3.Ad()over 20 random transforms -- confirmed it passes unchanged against both the old and new implementation.Test plan
test_Adpasses against the old implementation (self.SE3().Ad()) -- establishes the correctness baselinepytest tests/-- full suite, 343 passed, no regressionsnp.testing.assert_almost_equal)