-
Notifications
You must be signed in to change notification settings - Fork 16
R2NLS
solver for unconstrained nonlinear least-squares (NLS) problems
#311
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
base: main
Are you sure you want to change the base?
R2NLS
solver for unconstrained nonlinear least-squares (NLS) problems
#311
Conversation
Introduces the R2NLS solver, an inexact second-order quadratic regularization method for nonlinear least-squares, with support for multiple subproblem solvers including QRMumps. Updates documentation, tests, and dependencies to include R2NLS and its utilities, and adds comprehensive test coverage for the new solver and its subsolvers.
The finalizer that calls close! on QRMumpsSolver has been commented out due to crashes in libdqrm.dll during object finalization, likely caused by a double free or invalid pointer reference. Additional minor changes include switching from view to direct indexing for SparseMatrixCOO construction to avoid pointer issues, and reordering some operations in SolverCore.solve! for clarity.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #311 +/- ##
==========================================
+ Coverage 89.00% 89.40% +0.40%
==========================================
Files 7 8 +1
Lines 1200 1435 +235
==========================================
+ Hits 1068 1283 +215
- Misses 132 152 +20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Eliminated a duplicate call to mul!(∇f, Jx', r) in the SolverCore.solve! function to avoid unnecessary computation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @farhadrclass for the PR. I made a first batch of comments (but didn't check the new algorithm)
src/R2NLS.jl
Outdated
ls_subsolver.irn[1:ls_subsolver.nnzj], | ||
ls_subsolver.jcn[1:ls_subsolver.nnzj], | ||
ls_subsolver.val[1:ls_subsolver.nnzj], | ||
) #For now till they fix the SparseMatrixCOO to accept pointers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an open issue for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but @dpo and I thinking about this right now
SolverCore = "0.3" | ||
SolverParameters = "0.1" | ||
SolverTools = "0.9" | ||
SparseArrays = "1.11.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SparseArrays = "1.11.0" | |
SparseArrays = "1.10.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we want 1.10?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted utilities.jl and its tests, removing the opnorm/TSVD utilities and all related test coverage. Dropped Arpack and GenericLinearAlgebra from dependencies and compat, and updated code and tests to no longer use or include them. Fixed a typo in the CRLS subsolver dispatch in test_solvers.jl.
@tmigot thank you for the review, I applied most of what you recommend and asked some questions to confirm the rest |
Introduces the R2NLSParameterSet struct to encapsulate all algorithmic parameters for the R2NLS solver, replacing individual keyword arguments. Updates R2SolverNLS and R2NLS constructors and solve! logic to use the new parameter set, improving type safety, maintainability, and clarity of parameter handling.
This pull request introduces the new
R2NLS
solver for unconstrained nonlinear least-squares (NLS) problems, expands documentation and test coverage for this solver.Major features and solver additions:
R2NLS
solver, an inexact second-order quadratic regularization method for unconstrained NLS, to the codebase and exported it for use. (src/JSOSolvers.jl
,src/R2NLS.jl
,README.md
,docs/src/solvers.md
) [1] [2] [3] [4]R2NLS
as an available solver for unconstrained NLS problems. (docs/src/solvers.md
,README.md
) [1] [2] [3]Utilities and infrastructure:
opnorm
utility function inutilities.jl
that computes operator norms for both standard numeric and arbitrary element types, using LAPACK, ARPACK, or TSVD as appropriate. This is now included and exported in the main module. (src/utilities.jl
,src/JSOSolvers.jl
) [1] [2]opnorm
utility, covering multiple numeric types and matrix shapes. (test/test_Utilities.jl
)Testing enhancements:
R2NLS
and its subsolver variants in all relevant test suites, including allocation, callback, consistency, restart, and general solver tests. (test/allocs.jl
,test/callback.jl
,test/consistency.jl
,test/restart.jl
,test/runtests.jl
,test/test_solvers.jl
) [1] [2] [3] [4] [5] [6] [7]Dependency and import updates:
Arpack
,SparseArrays
, andKrylov
in both the main module and test files to support the new solver and utilities. (src/JSOSolvers.jl
,test/runtests.jl
) [1] [2]Note: