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

Fix integrate method for SO2 #1652

Merged
merged 9 commits into from May 13, 2022

Conversation

Toefinder
Copy link
Contributor

When the same vector reference is given to the integrate method as both
for input and for storing the output, the result is incorrectly
calculated due to inplace changes. This problem is fixed in this commit.
Close #1651

Copy link
Contributor

@jcarpent jcarpent left a comment

Choose a reason for hiding this comment

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

@Toefinder Thanks for the fix. It is a bit weird to use the same input/ouput arguments at first glance.
For readability, could you remove the line commits which are related to whitespace?

Thanks in advance,

@Toefinder Toefinder force-pushed the fix-integrate-SO2 branch 2 times, most recently from 92e0c92 to bbd3182 Compare May 12, 2022 17:13
@Toefinder
Copy link
Contributor Author

Toefinder commented May 12, 2022

It is a bit weird to use the same input/ouput arguments at first glance.

I thought so too, when first examining the code. But integrating in-place is used a lot as operator+=, such as this code. What surprised me even more after realising this bug was why this issue has not shown up earlier.

op.integrate(e_.template segment<LiegroupType::NQ>(iq_, op.nq()),
             v_.segment<LiegroupType::NV>(iv_, op.nv()),
             e_.template segment<LiegroupType::NQ>(iq_, op.nq()));

@jcarpent
Copy link
Contributor

It is a bit weird to use the same input/ouput arguments at first glance.

I thought so too, when first examining the code. But integrating in-place is used a lot as operator+=, such as this code. What surprised me even more after realising this bug was why this issue has not shown up earlier.

I would say that because this part of the code is not more used with operator+= and some compilers may optimise some part of this code.

When the same vector reference is given to the integrate method as both
for input and for storing the output, the result is incorrectly
calculated due to inplace changes. This problem is fixed in this commit.
@jcarpent
Copy link
Contributor

@Toefinder I've just force-pushed to align the histories.

@jcarpent jcarpent merged commit e836f35 into stack-of-tasks:devel May 13, 2022
@jcarpent
Copy link
Contributor

Thanks @Toefinder, for your contributions. Greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants