-
Notifications
You must be signed in to change notification settings - Fork 197
Equality-constrained least-squares solver #1046
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: master
Are you sure you want to change the base?
Equality-constrained least-squares solver #1046
Conversation
|
Unless I forgot something, I think this PR is ready to be reviewed :) |
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.
Pull Request Overview
This PR adds support for equality-constrained least-squares solving to the stdlib_linalg module. It introduces functionality to solve problems of the form: minimize ||Ax - b||² subject to Cx = d, using LAPACK's GGLSE backend.
Key changes:
- New constrained least-squares solver with both function and subroutine interfaces
- Support for workspace pre-allocation via
constrained_lstsq_space - Comprehensive test coverage and documentation examples
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/stdlib_linalg.fypp | Adds public interfaces for constrained_lstsq, solve_constrained_lstsq, and constrained_lstsq_space |
| src/stdlib_linalg_least_squares.fypp | Implements constrained least-squares solver, fixes typo "byu" → "by", adds check_problem_size validation |
| src/lapack/stdlib_linalg_lapack_aux.fypp | Adds handle_gglse_info error handler for GGLSE LAPACK routines |
| test/linalg/test_linalg_constrained_lstsq.fypp | Adds comprehensive test suite covering function, subroutine, and pre-allocated workspace interfaces |
| test/linalg/CMakeLists.txt | Registers new test file in build system |
| example/linalg/example_constrained_lstsq1.f90 | Demonstrates functional interface usage |
| example/linalg/example_constrained_lstsq2.f90 | Demonstrates subroutine interface with pre-allocated workspace |
| example/linalg/CMakeLists.txt | Registers example programs in build system |
| doc/specs/stdlib_linalg.md | Adds documentation for all three new interfaces |
Comments suppressed due to low confidence (2)
doc/specs/stdlib_linalg.md:1
- Corrected spelling of 'GLSE' to 'GGLSE' to match the actual LAPACK routine names.
---
doc/specs/stdlib_linalg.md:1
- Corrected spelling of 'GLSE' to 'GGLSE' to match the actual LAPACK routine names.
---
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1046 +/- ##
=========================================
Coverage ? 25.13%
=========================================
Files ? 570
Lines ? 234201
Branches ? 41267
=========================================
Hits ? 58870
Misses ? 175331
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Following #1044, this PR implements an equality-constrained least-squares solver based on
xGGLSEfromlapack.Proposed interfaces
call solve_constrained_lstsq(A, b, C, d, x [, storage, overwrite_matrices, err])x = constrained_lstsq(A, b, C, d [, overwrite_matrices, err])where
Aandbdefine the least-squares cost, whileCx = ddefine the equality constraints.Progress
Ping: @perazz, @jvdp1, @jalvesz