feat: implement Toeplitz and Hankel Procrustes#226
feat: implement Toeplitz and Hankel Procrustes#226Ao-chuba wants to merge 1 commit intotheochem:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #226 +/- ##
=======================================
Coverage ? 94.59%
=======================================
Files ? 12
Lines ? 869
Branches ? 0
=======================================
Hits ? 822
Misses ? 47
Partials ? 0
🚀 New features to boost your workflow:
|
bcf7d94 to
745d583
Compare
|
@FanwangM here's my PR please look into it, whenever you get time. |
There was a problem hiding this comment.
Pull request overview
This PR implements one-sided Toeplitz and Hankel Procrustes transformations by reformulating the constrained optimization problem as a linear least-squares problem over the structured parameter space. The implementation follows the approach described in Yang & Deng (2013).
Changes:
- Added
procrustes/toeplitz.pywithtoeplitz()andhankel()solvers that find optimal Toeplitz/Hankel transformation matrices - Added comprehensive test suite in
procrustes/test/test_toeplitz.pycovering exact recovery, structure validation, and error bounds - Updated
procrustes/__init__.pyto export the new functions
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| procrustes/toeplitz.py | Implements Toeplitz and Hankel Procrustes solvers using linear operator construction and least-squares optimization |
| procrustes/test/test_toeplitz.py | Comprehensive test suite validating exact recovery, structural properties, and comparison with generic Procrustes |
| procrustes/init.py | Exports new toeplitz module functions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add procrustes/toeplitz.py with toeplitz() and hankel() solvers - Both use a least-squares approach over the structured parameter space: vec(A @ T) = M @ t, solved via numpy.linalg.lstsq - Helper functions _build_toeplitz_operator, _build_hankel_operator, _params_to_toeplitz, _params_to_hankel kept private - Add procrustes/test/test_toeplitz.py with 24 tests covering: exact recovery, structure validation, error vs generic, shape errors, and ProcrustesResult field checks - Export toeplitz and hankel from procrustes/__init__.py
745d583 to
535e4de
Compare
|
@FanwangM , |
This PR implements Toeplitz and Hankel matrix Procrustes algorithms using a least squares approach over the structured parameter space.
The changes made are :
procrustes/toeplitz.pywithtoeplitz()andhankel()solvers.procrustes/test/test_toeplitz.pywith comprehensive tests for exact recovery and structure validation.procrustes/__init__.pyto export the new functions.Using the reference Yang, J., & Deng, Y. (2013). "Procrustes Problems for General, Triangular, and Symmetric Toeplitz Matrices."
Journal of Applied Mathematics, 2013.
closes #84