auto-differentiation / xad

Powerful automatic differentiation in C++ and Python
https://auto-differentiation.github.io
GNU Affero General Public License v3.0
257 stars 37 forks source link

Hessian and Jacobian #117

Closed raneamri closed 5 months ago

raneamri commented 5 months ago

Description

Implementation of Hessian and Jacobian class methods as per #37.

Features:

Unrelated changes:

github-actions[bot] commented 5 months ago

Test Results

    29 files  ±    0      29 suites  ±0   11m 26s :stopwatch: +28s  1 312 tests +   37   1 312 :white_check_mark: +   37  0 :zzz: ±0  0 :x: ±0  38 010 runs  +1 073  38 010 :white_check_mark: +1 073  0 :zzz: ±0  0 :x: ±0 

Results for commit a6263b67. ± Comparison against base commit 1b8be410.

:recycle: This comment has been updated with latest results.

raneamri commented 5 months ago

Since fwd_adj is theoretically the fastest higher order mode for computing Hessians, I'm unsure if I should implement overloads for other modes or enforce fwd_adj with Hessian.

auto-differentiation-dev commented 5 months ago

Since fwd_adj is theoretically the fastest higher order mode for computing Hessians, I'm unsure if I should implement overloads for other modes or enforce fwd_adj with Hessian.

Edited: I think fwd_adj would be sufficient for the first version, covering all useful cases. The only other one that may be used is fwd_fwd in case of a small number of inputs, as that avoids the overheads of a tape and may be faster.

coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9400516425

Details


Totals Coverage Status
Change from base Build 9366485824: 0.02%
Covered Lines: 2336
Relevant Lines: 2364

💛 - Coveralls
auto-differentiation-dev commented 5 months ago

Also feel free to merge or rebase main into your branch to keep it up to date.

coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9402307189

Details


Totals Coverage Status
Change from base Build 9366485824: 0.02%
Covered Lines: 2336
Relevant Lines: 2364

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9416215933

Details


Totals Coverage Status
Change from base Build 9366485824: 0.08%
Covered Lines: 2457
Relevant Lines: 2485

💛 - Coveralls
auto-differentiation-dev commented 5 months ago

Also we would like to eventually move the implementations of Hessian and Jacobian into source files, explicitly instantiating them for the possible types T where it makes sense. This gives us a chance to potentially optimise / parallelise the code in future directly with XAD compilation and keep the user code compatible.

Please disregard this for now. The templated iterator approach will not allow to move this to a source file. We can worry at this later if it's needed.

auto-differentiation-dev commented 5 months ago

Microsoft has made a jump in the toolset version recently - latest Visual Studio 2022 is now toolset 14.4. That makes the Windows builds fail. I'd say we make the toolsets tested 14.0, 14.1, 14.2, 14.4 now.

coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9416864531

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 87 89 97.75%
src/XAD/Jacobian.hpp 79 81 97.53%
<!-- Total: 166 170 97.65% -->
Totals Coverage Status
Change from base Build 9366485824: -0.08%
Covered Lines: 2457
Relevant Lines: 2489

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9437069353

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 74 76 97.37%
src/XAD/Jacobian.hpp 68 70 97.14%
<!-- Total: 142 146 97.26% -->
Totals Coverage Status
Change from base Build 9366485824: -0.09%
Covered Lines: 2433
Relevant Lines: 2465

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9437115504

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 74 76 97.37%
src/XAD/Jacobian.hpp 68 70 97.14%
<!-- Total: 142 146 97.26% -->
Totals Coverage Status
Change from base Build 9366485824: -0.09%
Covered Lines: 2433
Relevant Lines: 2465

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9437321860

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 74 76 97.37%
src/XAD/Jacobian.hpp 66 68 97.06%
<!-- Total: 140 144 97.22% -->
Totals Coverage Status
Change from base Build 9366485824: -0.09%
Covered Lines: 2431
Relevant Lines: 2463

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9446341563

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 48 56 85.71%
<!-- Total: 48 56 85.71% -->
Totals Coverage Status
Change from base Build 9366485824: -0.3%
Covered Lines: 2339
Relevant Lines: 2375

💛 - Coveralls
auto-differentiation-dev commented 5 months ago

Thanks for all the work - it looks like it's getting close to completion.

After addressing the comments, adding the docs, and giving it a once-over yourself and you feel it's ready, please mark the PR as "ready for review" - not draft anymore. And we'll give it a final check before merging.

coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9448033064

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 52 54 96.3%
src/XAD/Jacobian.hpp 52 54 96.3%
<!-- Total: 104 108 96.3% -->
Totals Coverage Status
Change from base Build 9366485824: -0.1%
Covered Lines: 2395
Relevant Lines: 2427

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9449063024

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 52 54 96.3%
src/XAD/Jacobian.hpp 52 54 96.3%
<!-- Total: 104 108 96.3% -->
Totals Coverage Status
Change from base Build 9366485824: -0.1%
Covered Lines: 2395
Relevant Lines: 2427

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9449458656

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 52 54 96.3%
src/XAD/Jacobian.hpp 52 54 96.3%
<!-- Total: 104 108 96.3% -->
Totals Coverage Status
Change from base Build 9366485824: -0.1%
Covered Lines: 2395
Relevant Lines: 2427

💛 - Coveralls
auto-differentiation-dev commented 5 months ago

Also a note regarding the documentation you added. The files under docs/ref go verbatim onto the documentation reference section on the website. They need to be written in the style of a reference manual - showing the functions provided, listing/explaining their parameters, along with a short description what the function or header does. Similar to the other files there. I believe headers.md will also need to be adapted for the 2 new headers that aren't included by default.

We will have to extend the docs in this part of the website (not part of this repository), and we will take part of what you have written so far for that with the next release.

coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9466495859

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 54 58 93.1%
src/XAD/Jacobian.hpp 54 58 93.1%
<!-- Total: 108 116 93.1% -->
Totals Coverage Status
Change from base Build 9366485824: -0.3%
Covered Lines: 2399
Relevant Lines: 2435

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9467581491

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 54 58 93.1%
src/XAD/Jacobian.hpp 56 60 93.33%
<!-- Total: 110 118 93.22% -->
Totals Coverage Status
Change from base Build 9366485824: -0.3%
Covered Lines: 2401
Relevant Lines: 2437

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9467629163

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 54 58 93.1%
src/XAD/Jacobian.hpp 56 60 93.33%
<!-- Total: 110 118 93.22% -->
Totals Coverage Status
Change from base Build 9366485824: -0.3%
Covered Lines: 2401
Relevant Lines: 2437

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9468181393

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 56 58 96.55%
src/XAD/Jacobian.hpp 58 60 96.67%
<!-- Total: 114 118 96.61% -->
Totals Coverage Status
Change from base Build 9366485824: -0.1%
Covered Lines: 2405
Relevant Lines: 2437

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9468434477

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 55 56 98.21%
src/XAD/Jacobian.hpp 58 60 96.67%
<!-- Total: 113 116 97.41% -->
Totals Coverage Status
Change from base Build 9366485824: -0.07%
Covered Lines: 2404
Relevant Lines: 2435

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9472794925

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 55 56 98.21%
src/XAD/Jacobian.hpp 58 60 96.67%
<!-- Total: 113 116 97.41% -->
Totals Coverage Status
Change from base Build 9366485824: -0.07%
Covered Lines: 2404
Relevant Lines: 2435

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9472947691

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 55 56 98.21%
src/XAD/Jacobian.hpp 58 60 96.67%
<!-- Total: 113 116 97.41% -->
Totals Coverage Status
Change from base Build 9366485824: -0.07%
Covered Lines: 2404
Relevant Lines: 2435

💛 - Coveralls
coveralls commented 5 months ago

Pull Request Test Coverage Report for Build 9480444406

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/XAD/Hessian.hpp 55 56 98.21%
src/XAD/Jacobian.hpp 58 60 96.67%
<!-- Total: 113 116 97.41% -->
Totals Coverage Status
Change from base Build 9366485824: -0.07%
Covered Lines: 2404
Relevant Lines: 2435

💛 - Coveralls