vgvassilev / clad

clad -- automatic differentiation for C/C++
GNU Lesser General Public License v3.0
291 stars 122 forks source link

Add support for std::initializer_list in the reverse mode #1018

Closed PetroZarytskyi closed 3 months ago

PetroZarytskyi commented 3 months ago

This PR adds support for std::initializer_list in the reverse mode. Also, this PR adds support for non-array type ranges and removes redundant assignments by simplifying the logic for range-based for loops. Apart from that, it adds support for std::begin/std::end, and introduces begin/end functions to clad::array. Fixes #830.

github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 94.28%. Comparing base (b7f8e5d) to head (d93e52c). Report is 6 commits behind head on master.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/vgvassilev/clad/pull/1018/graphs/tree.svg?width=650&height=150&src=pr&token=9f6Q4em8hE&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev)](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev) ```diff @@ Coverage Diff @@ ## master #1018 +/- ## ========================================== + Coverage 94.12% 94.28% +0.16% ========================================== Files 55 55 Lines 8266 8293 +27 ========================================== + Hits 7780 7819 +39 + Misses 486 474 -12 ``` | [Files](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev) | Coverage Δ | | |---|---|---| | [include/clad/Differentiator/EstimationModel.h](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=include%2Fclad%2FDifferentiator%2FEstimationModel.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-aW5jbHVkZS9jbGFkL0RpZmZlcmVudGlhdG9yL0VzdGltYXRpb25Nb2RlbC5o) | `100.00% <ø> (ø)` | | | [include/clad/Differentiator/ReverseModeVisitor.h](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=include%2Fclad%2FDifferentiator%2FReverseModeVisitor.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-aW5jbHVkZS9jbGFkL0RpZmZlcmVudGlhdG9yL1JldmVyc2VNb2RlVmlzaXRvci5o) | `97.97% <ø> (ø)` | | | [include/clad/Differentiator/VisitorBase.h](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=include%2Fclad%2FDifferentiator%2FVisitorBase.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-aW5jbHVkZS9jbGFkL0RpZmZlcmVudGlhdG9yL1Zpc2l0b3JCYXNlLmg=) | `100.00% <ø> (ø)` | | | [lib/Differentiator/EstimationModel.cpp](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=lib%2FDifferentiator%2FEstimationModel.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-bGliL0RpZmZlcmVudGlhdG9yL0VzdGltYXRpb25Nb2RlbC5jcHA=) | `100.00% <ø> (ø)` | | | [lib/Differentiator/ReverseModeVisitor.cpp](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=lib%2FDifferentiator%2FReverseModeVisitor.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-bGliL0RpZmZlcmVudGlhdG9yL1JldmVyc2VNb2RlVmlzaXRvci5jcHA=) | `97.80% <100.00%> (+0.02%)` | :arrow_up: | | [lib/Differentiator/VisitorBase.cpp](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=lib%2FDifferentiator%2FVisitorBase.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-bGliL0RpZmZlcmVudGlhdG9yL1Zpc2l0b3JCYXNlLmNwcA==) | `96.86% <100.00%> (+0.13%)` | :arrow_up: | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/vgvassilev/clad/pull/1018/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev) | [Files](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev) | Coverage Δ | | |---|---|---| | [include/clad/Differentiator/EstimationModel.h](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=include%2Fclad%2FDifferentiator%2FEstimationModel.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-aW5jbHVkZS9jbGFkL0RpZmZlcmVudGlhdG9yL0VzdGltYXRpb25Nb2RlbC5o) | `100.00% <ø> (ø)` | | | [include/clad/Differentiator/ReverseModeVisitor.h](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=include%2Fclad%2FDifferentiator%2FReverseModeVisitor.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-aW5jbHVkZS9jbGFkL0RpZmZlcmVudGlhdG9yL1JldmVyc2VNb2RlVmlzaXRvci5o) | `97.97% <ø> (ø)` | | | [include/clad/Differentiator/VisitorBase.h](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=include%2Fclad%2FDifferentiator%2FVisitorBase.h&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-aW5jbHVkZS9jbGFkL0RpZmZlcmVudGlhdG9yL1Zpc2l0b3JCYXNlLmg=) | `100.00% <ø> (ø)` | | | [lib/Differentiator/EstimationModel.cpp](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=lib%2FDifferentiator%2FEstimationModel.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-bGliL0RpZmZlcmVudGlhdG9yL0VzdGltYXRpb25Nb2RlbC5jcHA=) | `100.00% <ø> (ø)` | | | [lib/Differentiator/ReverseModeVisitor.cpp](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=lib%2FDifferentiator%2FReverseModeVisitor.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-bGliL0RpZmZlcmVudGlhdG9yL1JldmVyc2VNb2RlVmlzaXRvci5jcHA=) | `97.80% <100.00%> (+0.02%)` | :arrow_up: | | [lib/Differentiator/VisitorBase.cpp](https://app.codecov.io/gh/vgvassilev/clad/pull/1018?src=pr&el=tree&filepath=lib%2FDifferentiator%2FVisitorBase.cpp&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev#diff-bGliL0RpZmZlcmVudGlhdG9yL1Zpc2l0b3JCYXNlLmNwcA==) | `96.86% <100.00%> (+0.13%)` | :arrow_up: | ... and [2 files with indirect coverage changes](https://app.codecov.io/gh/vgvassilev/clad/pull/1018/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vassil+Vassilev)
github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"

github-actions[bot] commented 3 months ago

clang-tidy review says "All clean, LGTM! :+1:"