Skip to content
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

Implement chainrules #279

Merged
merged 2 commits into from
Jul 6, 2023
Merged

Implement chainrules #279

merged 2 commits into from
Jul 6, 2023

Conversation

migrosser
Copy link
Contributor

This PR implements chainrules for the product of a linear operator with vectors and is a fix for issue #278 .

To avoid adding additional dependencies, the chainrules are implemented in the extension LinearOperatorsChainRulesCoreExt. Thus, they will only be loaded if the module ChainRulesCore is loaded. This cooresponds to the approach taken by AbstractFFTs.jl.

So far, this PR contains chainrules for the functions *(op::AbstractLinearOperator{T}, v::AbstractVector{S}) and *(v::Union{Transpose{S, V}, Adjoint{S, V}}, op::AbstractLinearOperator{T}). There might exist further functions for which a chainrule might be useful, but to me these two appeared to contain most use-cases for the combination Zygote.jl / LinearOperators.jl

@codecov
Copy link

codecov bot commented Jul 6, 2023

Codecov Report

Patch coverage: 73.52% and project coverage change: -0.86 ⚠️

Comparison is base (320283a) 97.43% compared to head (f761fec) 96.57%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #279      +/-   ##
==========================================
- Coverage   97.43%   96.57%   -0.86%     
==========================================
  Files          14       15       +1     
  Lines        1013     1052      +39     
==========================================
+ Hits          987     1016      +29     
- Misses         26       36      +10     
Impacted Files Coverage Δ
src/LinearOperators.jl 75.00% <66.66%> (-25.00%) ⬇️
ext/LinearOperatorsChainRulesCoreExt.jl 74.19% <74.19%> (ø)

... and 5 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2023

Package name latest stable
CaNNOLeS.jl
DCISolver.jl
FletcherPenaltySolver.jl
JSOSolvers.jl
Krylov.jl
NLPModels.jl
NLPModelsModifiers.jl
PROPACK.jl
Percival.jl
QuadraticModels.jl
SolverTools.jl

Copy link
Member

@dpo dpo left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you!

@dpo dpo merged commit 70752d4 into JuliaSmoothOptimizers:main Jul 6, 2023
38 of 42 checks passed
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.

None yet

2 participants