JuliaSmoothOptimizers / LinearOperators.jl

Linear Operators for Julia
Other
150 stars 32 forks source link

Add reset function for Diagonal QN operators, fix bug SpectralGradient #266

Closed geoffroyleconte closed 1 year ago

geoffroyleconte commented 1 year ago

Following https://github.com/JuliaSmoothOptimizers/NLPModelsModifiers.jl/pull/94, I added reset! functions that restore the QN operators to the identity operator.

At the same time, I spotted a bug with SpectralGradient where the push was not updating d in the closure prod = (res, v, α, β) -> mulSquareOpDiagonal!(res, d, v, α, β) (because d was a Real). I fixed it by changing d to [σ] so that modifying d[1] modifies mulSquareOpDiagonal!(res, d, v, α, β) accordingly.

This modifies the way we update a SpectralGradient: we have to do op.d[1] = 2.0 instead of op.d = 2.0, but since we are supposed to update this operator with push!, this should not break code.

Does the adding of the reset! function requires a new minor release 2.6.0, or can we stick to a patch 2.5.1?

codecov[bot] commented 1 year ago

Codecov Report

Base: 97.38% // Head: 97.42% // Increases project coverage by +0.03% :tada:

Coverage data is based on head (2b9fa2b) compared to base (f2fe71c). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #266 +/- ## ========================================== + Coverage 97.38% 97.42% +0.03% ========================================== Files 14 14 Lines 996 1009 +13 ========================================== + Hits 970 983 +13 Misses 26 26 ``` | [Impacted Files](https://codecov.io/gh/JuliaSmoothOptimizers/LinearOperators.jl/pull/266?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaSmoothOptimizers) | Coverage Δ | | |---|---|---| | [src/DiagonalHessianApproximation.jl](https://codecov.io/gh/JuliaSmoothOptimizers/LinearOperators.jl/pull/266?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaSmoothOptimizers#diff-c3JjL0RpYWdvbmFsSGVzc2lhbkFwcHJveGltYXRpb24uamw=) | `95.34% <100.00%> (+2.01%)` | :arrow_up: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaSmoothOptimizers). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaSmoothOptimizers)

:umbrella: View full report at Codecov.
: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