-
Notifications
You must be signed in to change notification settings - Fork 2
Fix: field reload for sparse sign compressor #140
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
Conversation
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 validation and error handling for field modifications on the SparseSign compressor after initialization. The implementation uses a custom setproperty! method to enforce constraints when users modify the compression_dim or nnz fields.
- Added custom
setproperty!method to validate field changes onSparseSigninstances - Imported
setproperty!from Base in the main module - Added comprehensive test coverage for field modification scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/RLinearAlgebra.jl | Imported setproperty! from Base to support custom property setter |
| src/Compressors/sparse_sign.jl | Added custom setproperty! method to validate compression_dim and nnz field modifications |
| test/Compressors/sparse_sign.jl | Added test cases for valid and invalid field modifications including edge cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Description
Reload the property when the user changes the properties after building the
SparseSignstruct.Motivation and Context
To ensure robust usage, we have added validation and error signaling when users attempt to modify
SparseSigncompressor properties after initialization. This addresses the previous issue where error detection was deferred until the solver construction phase, leading to delayed and unclear feedback about invalid configurations.How has this been tested
Try the following codes:
Types of changes
Checklists:
Code and Comments
If this PR includes modification to the code base, please select all that apply.
API Documentation
Manual Documentation
Testing
@code_lowered and
@code_typed)