Skip to content

Implement SolverCore.reset!(solver) function#293

Open
MaxenceGollier wants to merge 5 commits intoJuliaSmoothOptimizers:masterfrom
MaxenceGollier:r2n-reset
Open

Implement SolverCore.reset!(solver) function#293
MaxenceGollier wants to merge 5 commits intoJuliaSmoothOptimizers:masterfrom
MaxenceGollier:r2n-reset

Conversation

@MaxenceGollier
Copy link
Collaborator

closes #268

Added a function that resets the initial vector of the power norm iteration method.

Copilot AI review requested due to automatic review settings February 13, 2026 18:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses issue #268 by eliminating solver statefulness across repeated solve! calls: it resets the initial vector used by the power-method-based operator-norm estimate so running the same solver instance twice yields consistent results.

Changes:

  • Added _reset_power_method! helper to reinitialize the power method starting vector.
  • Invoked _reset_power_method! at the beginning of solve! for TRSolver and R2NSolver.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/utils.jl Adds _reset_power_method! used to reinitialize the power iteration vector.
src/TR_alg.jl Calls _reset_power_method! at the start of solve! to prevent cross-run drift.
src/R2N.jl Calls _reset_power_method! at the start of solve! to prevent cross-run drift.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 0% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.73%. Comparing base (e0f214d) to head (3c898ec).
⚠️ Report is 268 commits behind head on master.

Files with missing lines Patch % Lines
src/R2N.jl 0.00% 5 Missing ⚠️
src/TR_alg.jl 0.00% 5 Missing ⚠️
src/R2DH.jl 0.00% 3 Missing ⚠️
src/TRDH_alg.jl 0.00% 3 Missing ⚠️
src/utils.jl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #293       +/-   ##
===========================================
+ Coverage   61.53%   83.73%   +22.20%     
===========================================
  Files          11       13        +2     
  Lines        1292     1642      +350     
===========================================
+ Hits          795     1375      +580     
+ Misses        497      267      -230     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MaxenceGollier MaxenceGollier changed the title add _reset_power_norm function add resets when calling solve! Feb 13, 2026
@MaxenceGollier
Copy link
Collaborator Author

@MohamedLaghdafHABIBOULLAH, in JSOSolvers.jl, the way we actually do it is just to have a reset function available, not to directly call it at each solve. That's what i will do to keep the solvers compliant.

@MaxenceGollier MaxenceGollier changed the title add resets when calling solve! Implement SolverCore.reset!(solver) function Feb 13, 2026
@MaxenceGollier
Copy link
Collaborator Author

Let me know what you think, @MohamedLaghdafHABIBOULLAH.

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.

Executing R2N twice in a row does not give the same answer

1 participant