-
Notifications
You must be signed in to change notification settings - Fork 33
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
Introduce move semantics to adouble, clean-up tape types, clean-up include files #96
Open
TimSiebert1
wants to merge
66
commits into
coin-or:master
Choose a base branch
from
TimSiebert1:improve_tape_types
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
…rary adouble object. However, this can be directly achieve by by C++'s move semantics. On the other hand we start replacing the plain size_t location with a more type-safe struct "tape_location". Finally, the inheritance structure (badouble, adouble, adub) is removed, because its not needed with the changes explained above.
…cs, shift function declarations to adouble class
…erf and erfc to new class structure and move semantics
…quad to new type structure and move semantics
…iguousLocaitons to StorageManager
…cs out of class and leverage getter of adouble and pdouble
…ifferentiated function is now after the call to adouble_func because this function can change the location of the output due to move semantics
…ouble version of the external function
…more things; aligned with cppcoreguidelines
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #96 +/- ##
==========================================
- Coverage 68.49% 68.47% -0.02%
==========================================
Files 53 53
Lines 28596 28919 +323
Branches 1861 1999 +138
==========================================
+ Hits 19586 19803 +217
- Misses 9010 9116 +106
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…ince the function argument evaluation order is not fixed
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.
This PR:
adouble
as proposed in Move sematics for adouble #94;The main idea is that
adub
s are completely replaced by proper treatment of r-value references. This results in the updatedadouble
class without the need for an inheritance structure. Thus,badouble
andadub
are removed.Prior to the proposed changes, each arithmetic operation generates a new tape-location regardless of whether the input is a temporary (r-value reference) or not. This potentially lead to a significant number of "wasted" locations.
In the proposed changes and for most operations the arithmetic operation does creating a new
adouble
if the input is an r-value reference. To this end the operations are overloaded for r-value references, there is a move constructor and a move assignment.As a result, an expression like
0.5 * (x + u/x)
, which would create in the current implementation threeadub
(basicallyadoubles
) with new locations, the new version would only create a single new location and move it between the operations.Please note that I introduce a lot of code-duplications when defining the operations for r-value references. They should be definitely removed at some point and are an item on my list 😃