Add ReverseDiff extension with analytical pullbacks#216
Draft
Add ReverseDiff extension with analytical pullbacks#216
Conversation
…apunov, and model functions Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
… failed NSSS solutions Co-authored-by: thorek1 <13523097+thorek1@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add extension for reversediff.jl using chainrules
Add ReverseDiff extension with analytical pullbacks
Jan 1, 2026
This file contains hidden or 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
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.
Adds ReverseDiff.jl support using the analytical pullbacks already defined via ChainRulesCore rrules. Since
@grad_from_chainrulesdoesn't support keyword arguments, implements customSpecialInstructiontypes that record operations on ReverseDiff's tape and execute analytical gradients during the reverse pass.Supported functions
solve_lyapunov_equation/solve_sylvester_equation- all tracked/untracked input combinationscalculate_jacobian,calculate_hessian,calculate_third_order_derivativesget_NSSS_and_parameters- with proper zero-gradient handling for failed solutionsUsage
Implementation
ext/ReverseDiffExt.jlwithSpecialInstructiondispatch typesspecial_forward_exec!/special_reverse_exec!methods for each function∂A = ∂C * A * P' + ∂C' * A * P)Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.