-
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
base: master
Are you sure you want to change the base?
Conversation
…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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #96 +/- ##
==========================================
+ Coverage 68.49% 72.73% +4.24%
==========================================
Files 53 57 +4
Lines 28596 30934 +2338
Branches 1861 1988 +127
==========================================
+ Hits 19586 22501 +2915
+ Misses 9010 8433 -577
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
That's a lot of stuff for a single pull request. If possible, splitting it into several parts would make it easier to review. |
Hmm, that would probably be a lot of work... But if you want to check each PR carefully, I could do that. Otherwise, I could explain the changes in more detail in a meeting. |
…e. When using the adoubles in euler_step_act, the locations are changed due to move semantics. The resulting locaitons are not consecutive. Allocating a second vector fix it
…i dont see the usecase. On the other hand this already caused the bug that no adouble was reused
…location is stored on the tape
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 😃