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

Bugfix in uni5_for.c and in test #88

Merged
merged 10 commits into from
Dec 12, 2024
Merged

Conversation

TimSiebert1
Copy link
Collaborator

Hi,
this PR includes a bugfix in

  • uni5_for.c
  • traceOperatorVector.cpp

uni5_for.c:
There was a bug when calculating the derivative of fmax or fmin at the tie-point with the tape-based forward mode. In principle, there was a missing else that encapsulates the pointer increment: Targ1++ and Targ2++. Due to the missing else, the pointers got sometimes incremented twice, when the loop macro FOR_0_LE_i_LT_k was not defined.

traceOperatorVector.cpp
I also corrected the tests for the tie-points of fmax and fmin, based on following assumption for the "correct" behavior:
If we have two adouble variables a and b that are equal, the derivative yd of fmax calculated by fov_forward is given by the column-wise maximum of the provided tangent matrix xd. Meaning, if xd[0][0] = 1.3, xd[1][0] = -1.3, xd[0][1] = -1.3, xd[1][1] = 4.0 we would get yd = [1.3, 4.0] (= [std::fmax(xd[0][0], xd[1][0]), std::fmax(xd[0][1], xd[1][1])]). If on the other hand, b is a constant (double) yd is given by the maximum between the corresponding xd entries and 0.0 (i.e. [std::fmax(xd[0][0], 0.0), std::fmx(xd[0][1], 0.0)]).

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.25%. Comparing base (a02023b) to head (3c1f1ed).
Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #88      +/-   ##
==========================================
+ Coverage   65.95%   66.25%   +0.29%     
==========================================
  Files          51       51              
  Lines       26473    26686     +213     
  Branches     1843     1843              
==========================================
+ Hits        17461    17680     +219     
+ Misses       9012     9006       -6     
Flag Coverage Δ
unittests 66.25% <100.00%> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@awalther1 awalther1 merged commit 76eb6a0 into coin-or:master Dec 12, 2024
38 of 39 checks passed
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.

2 participants