Conversation
Implements the operator proposed in issue JuliaSmoothOptimizers#257: at each push!, it attempts a BFGS update (preserving positive definiteness) and falls back to an SR1 update (capturing negative curvature) when BFGS's numerical safeguards (sᵀy > 0, sᵀBs > 0) are not satisfied, rejecting the pair only if neither is well defined. Internally each memory slot is stored as one or two signed rank-one dyads, recomputed each push in chronological order (as LBFGSOperator and LSR1Operator already do), so mixed BFGS/SR1 histories share the same compact-representation machinery. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
LQNData can become internally inconsistent when mem <= 0 (allocated slot buffers length mem but data.mem == max(mem,1)), leading to out-of-bounds indexing.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new limited-memory quasi-Newton operator (LQNOperator) to LinearOperators.jl that hybridizes BFGS and SR1 updates by selecting the first numerically well-defined update at each push!, and wires it into the existing quasi-Newton module and test suite.
Changes:
- Introduce
LQNOperatorwith automatic BFGS-first, SR1-fallback update selection and a compact signed rank-one representation. - Add comprehensive tests covering selection behavior, rejection behavior, dense-reference agreement, allocations, and eigenvalue sanity.
- Register the new operator in
src/qn.jland ensure tests run viatest/runtests.jl.
File summaries
| File | Description |
|---|---|
| src/lqn.jl | Implements LQNOperator and its storage/update logic (BFGS/SR1 hybrid). |
| src/qn.jl | Includes the new lqn.jl module into the quasi-Newton entry point. |
| test/test_lqn.jl | Adds test coverage for correctness, rejection rules, allocations, and eigen behavior. |
| test/runtests.jl | Ensures the new tests are executed in CI/local test runs. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
LQNOperator: a hybrid limited-memory BFGS/SR1 quasi-Newton operator
This branch has not been deployed
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.
@tmigot @dpo Fixes #257
At each push!, it attempts a BFGS update (preserving positive definiteness) and falls back to an SR1 update (capturing negative curvature) when BFGS's numerical safeguards (
sᵀy > 0,sᵀBs > 0) are not satisfied, rejecting the pair only if neither is well defined. Internally each memory slot is stored as one or two signed rank-one dyads, recomputed each push in chronological order (asLBFGSOperatorandLSR1Operatoralready do), so mixed BFGS/SR1 histories share the same compact-representation machinery.