- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 233
feat: support alternative AD backends in linearization #3477
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
          
     Merged
      
      
            ChrisRackauckas
  merged 6 commits into
  SciML:master
from
AayushSabharwal:as/linearize-ad
  
      
      
   
  Mar 26, 2025 
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            6 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      247160d
              
                feat: use DI to calculate jacobians in `LinearizationFunction`
              
              
                AayushSabharwal da84f0c
              
                test: test alternative AD backends for linearization
              
              
                AayushSabharwal f9b0fd3
              
                refactor: remove `jacobian_wrt_vars`
              
              
                AayushSabharwal c143095
              
                Update src/linearization.jl
              
              
                AayushSabharwal 5c5a676
              
                fix: handle case when `prob.u0 === nothing` in `linearization_function`
              
              
                AayushSabharwal d448fc5
              
                fix: fix typo
              
              
                AayushSabharwal File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -4,6 +4,7 @@ authors = ["Yingbo Ma <[email protected]>", "Chris Rackauckas <accounts@chrisr | |
| version = "9.68.1" | ||
|  | ||
| [deps] | ||
| ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" | ||
| AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" | ||
| ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" | ||
| BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" | ||
|  | @@ -16,6 +17,7 @@ DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e" | |
| DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def" | ||
| DiffEqNoiseProcess = "77a26b50-5914-5dd7-bc55-306e6241c503" | ||
| DiffRules = "b552c78f-8df3-52c6-915a-8e097449b14b" | ||
| DifferentiationInterface = "a0c0ee7d-e4b9-4e03-894e-1c5f64a51d63" | ||
| Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" | ||
| Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" | ||
| DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" | ||
|  | @@ -77,6 +79,7 @@ MTKInfiniteOptExt = "InfiniteOpt" | |
| MTKLabelledArraysExt = "LabelledArrays" | ||
|  | ||
| [compat] | ||
| ADTypes = "1.14.0" | ||
| AbstractTrees = "0.3, 0.4" | ||
| ArrayInterface = "6, 7" | ||
| BifurcationKit = "0.4" | ||
|  | @@ -96,6 +99,7 @@ DiffEqBase = "6.165.1" | |
| DiffEqCallbacks = "2.16, 3, 4" | ||
| DiffEqNoiseProcess = "5" | ||
| DiffRules = "0.1, 1.0" | ||
| DifferentiationInterface = "0.6.47" | ||
| Distributed = "1" | ||
| Distributions = "0.23, 0.24, 0.25" | ||
| DocStringExtensions = "0.7, 0.8, 0.9" | ||
|  | @@ -156,8 +160,8 @@ julia = "1.9" | |
| [extras] | ||
| AmplNLWriter = "7c4d4715-977e-5154-bfe0-e096adeac482" | ||
| BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
| BoundaryValueDiffEqMIRK = "1a22d4ce-7765-49ea-b6f2-13c8438986a6" | ||
| BoundaryValueDiffEqAscher = "7227322d-7511-4e07-9247-ad6ff830280e" | ||
| BoundaryValueDiffEqMIRK = "1a22d4ce-7765-49ea-b6f2-13c8438986a6" | ||
| ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e" | ||
| DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0" | ||
| DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6" | ||
|  | ||
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
  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.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to use
DI.ConstantOrCachefor the parameterpif it contains storage where active data gets writtenThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's never written to.
setteris out of place.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok good, the same remark holds for other uses of Constant but I guess it gets the same answer. Just asking because we had the issue in OrdinaryDiffEq
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the review nonetheless! It's nice to be doubly sure this is correct