Skip to content

Add basic reverse-mode custom derivatives for STL iterators - #1437

Merged
vgvassilev merged 1 commit into
vgvassilev:masterfrom
arima-04:IteratorsCustomDerivatives
Jul 6, 2025
Merged

Add basic reverse-mode custom derivatives for STL iterators#1437
vgvassilev merged 1 commit into
vgvassilev:masterfrom
arima-04:IteratorsCustomDerivatives

Conversation

@arima-04

@arima-04 arima-04 commented Jul 5, 2025

Copy link
Copy Markdown
Contributor

This commit adds basic reverse-mode custom derivatives for STL iterators. More specifically, the commit adds the below custom derivatives:

  • operator_star_reverse_forw for iterators
  • constructor_reverse_forw for iterators
  • operator_plus_plus_reverse_forw and operator_plus_plus_pullback for iterators

Closes #751

@vgvassilev
vgvassilev requested a review from PetroZarytskyi July 5, 2025 15:47

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

template <class T>
struct is_iterator<
T, typename ::std::enable_if<!::std::is_same<
typename ::std::iterator_traits<T>::value_type, void>::value>::type>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use c++14 style type templates [modernize-type-traits]

Suggested change
typename ::std::iterator_traits<T>::value_type, void>::value>::type>
T, ::std::enable_if_t<!::std::is_same<
typename ::std::iterator_traits<T>::value_type, void>::value>>

Comment thread include/clad/Differentiator/STLBuiltins.h
@codecov

codecov Bot commented Jul 5, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@arima-04
arima-04 force-pushed the IteratorsCustomDerivatives branch 3 times, most recently from 6cc140d to 7db8bc4 Compare July 5, 2025 18:15
This commit adds basic reverse-mode custom derivatives for STL
iterators. More specifically, the commit adds the below custom
derivatives:

- operator_star_reverse_forw for iterators
- constructor_reverse_forw for iterators
- operator_plus_plus_reverse_forw and operator_plus_plus_pullback for
  iterators

Closes vgvassilev#751
@arima-04
arima-04 force-pushed the IteratorsCustomDerivatives branch from 7db8bc4 to 9a43650 Compare July 5, 2025 18:37

@vgvassilev vgvassilev left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @arima-04!

@vgvassilev
vgvassilev merged commit 2271c02 into vgvassilev:master Jul 6, 2025
88 checks passed
@ovdiiuv

ovdiiuv commented Jul 6, 2025

Copy link
Copy Markdown
Collaborator

This now fails on master.

PetroZarytskyi added a commit to PetroZarytskyi/clad that referenced this pull request Jul 6, 2025
…t the same time.

This PR addresses 2 problems that arose after that: a mismatch in the signature of a new custom `reverse_forw` and a new tape popping up in a test.
vgvassilev pushed a commit that referenced this pull request Jul 6, 2025
This PR addresses 2 problems that arose after that: a mismatch in the signature of a new custom `reverse_forw` and a new tape popping up in a test.
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.

Add support for iterators of stl containers

3 participants