Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve math::AreAutoDiffVecXdEqual #19393

Merged
merged 1 commit into from
May 11, 2023

Conversation

RussTedrake
Copy link
Contributor

@RussTedrake RussTedrake commented May 11, 2023

Previously, it was possible that ExtractGradient (and therefore AreAutoDiffVecXdEqual) would throw, when this method should simply return false. Now we handle the case where the elements of the vector could have a different number of derivative values.

This version should also be slightly faster.

N.B. This came up for me because I had two different constraints setting values in a shared Context, but one was calling SetPositions(), and the other was calling SetPositionsAndVelocities().


This change is Reviewable

Previously, it was possible that ExtractGradient (and therefore
AreAutoDiffVecXdEqual) would throw, when this method should simply
return false. Now we handle the case where the elements of the vector
could have a different number of derivative values.

This version should also be slightly faster.

N.B. This came up for me because I had two different constraints
setting values in a shared Context, but one was calling
SetPositions(), and the other was calling SetPositionsAndVelocities().
Copy link
Contributor Author

@RussTedrake RussTedrake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@sammy-tri for both reviews, please?

Reviewable status: LGTM missing from assignee sammy-tri(platform), needs at least two assigned reviewers, missing label for release notes (waiting on @RussTedrake and @sammy-tri)

@RussTedrake RussTedrake added release notes: fix This pull request contains fixes (no new features) status: single reviewer ok https://drake.mit.edu/reviewable.html priority: medium labels May 11, 2023
Copy link
Contributor

@sammy-tri sammy-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignee sammy-tri(platform)

@sammy-tri sammy-tri merged commit 8ecb82d into RobotLocomotion:master May 11, 2023
@RussTedrake RussTedrake deleted the autodiff_equal branch June 12, 2023 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium release notes: fix This pull request contains fixes (no new features) status: single reviewer ok https://drake.mit.edu/reviewable.html
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants