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 for bug in linear constraint gradient. #161

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions momentum/character_solver/limit_error_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ double LimitErrorFunctionT<T>::getGradient(
error += residual * residual * limit.weight * tWeight;

if (this->enabledParameters_.test(data.targetIndex)) {
gradient[data.targetIndex] += T(2) * residual * data.scale * tWeight;
gradient[data.targetIndex] += T(2) * residual * data.scale * limit.weight * tWeight;
}
if (this->enabledParameters_.test(data.referenceIndex)) {
gradient[data.referenceIndex] -= T(2) * residual * tWeight;
gradient[data.referenceIndex] -= T(2) * residual * limit.weight * tWeight;
}
}
break;
Expand Down
4 changes: 2 additions & 2 deletions momentum/test/character_solver/error_functions_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ TYPED_TEST(Momentum_ErrorFunctionsTest, LimitError_GradientsAndJacobians) {
SCOPED_TRACE("Limit LinearTest");
ParameterLimit limit;
limit.type = Linear;
limit.weight = 1.0;
limit.weight = 1.5;
limit.data.linear.referenceIndex = 0;
limit.data.linear.targetIndex = 5;
limit.data.linear.scale = 0.25;
Expand Down Expand Up @@ -134,7 +134,7 @@ TYPED_TEST(Momentum_ErrorFunctionsTest, LimitError_GradientsAndJacobians) {
limit.type = LimitType::Linear;
limit.data.linear.referenceIndex = 0;
limit.data.linear.targetIndex = 5;
limit.weight = 1.0f;
limit.weight = 0.5f;

{
ParameterLimit cur = limit;
Expand Down
Loading