JuliaSmoothOptimizers / LinearOperators.jl

Linear Operators for Julia
Other
150 stars 32 forks source link

Implement chainrules #279

Closed migrosser closed 1 year ago

migrosser commented 1 year ago

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[bot] commented 1 year ago

Codecov Report

Patch coverage: 73.52% and project coverage change: -0.86 :warning:

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

Additional details and impacted files ```diff @@ 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](https://app.codecov.io/gh/JuliaSmoothOptimizers/LinearOperators.jl/pull/279?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaSmoothOptimizers) | Coverage Δ | | |---|---|---| | [src/LinearOperators.jl](https://app.codecov.io/gh/JuliaSmoothOptimizers/LinearOperators.jl/pull/279?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaSmoothOptimizers#diff-c3JjL0xpbmVhck9wZXJhdG9ycy5qbA==) | `75.00% <66.66%> (-25.00%)` | :arrow_down: | | [ext/LinearOperatorsChainRulesCoreExt.jl](https://app.codecov.io/gh/JuliaSmoothOptimizers/LinearOperators.jl/pull/279?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaSmoothOptimizers#diff-ZXh0L0xpbmVhck9wZXJhdG9yc0NoYWluUnVsZXNDb3JlRXh0Lmps) | `74.19% <74.19%> (ø)` | | ... and [5 files with indirect coverage changes](https://app.codecov.io/gh/JuliaSmoothOptimizers/LinearOperators.jl/pull/279/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaSmoothOptimizers)

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

github-actions[bot] commented 1 year ago
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