[WIP] Add upper_tri and diag_mat affine atoms#54
Merged
Conversation
Both are thin wrappers that compute flat column-major index arrays and delegate to new_index. diag_mat extracts the diagonal of a square matrix into a vector. upper_tri extracts strict upper triangular elements (excluding diagonal). Also removes a duplicate new_diag_vec declaration in affine.h. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
6 tasks
Collaborator
Author
|
@dance858 you can wait before reviewing this. |
# Conflicts: # include/atoms/affine.h # src/atoms/affine/diag_mat.c # src/atoms/affine/upper_tri.c # tests/all_tests.c
CVXPY's upper_tri returns elements row-by-row (i outer, j inner), which differs from the engine's typical column-major convention. Swap the loop nesting to iterate rows-then-columns for compatibility. Add a 4x4 forward test that distinguishes the two orderings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The 3x3 tests produced identical indices for both row-major and column-major orderings, so they didn't actually verify the fix. 4x4 indices [4,8,12,9,13,14] differ from column-major [4,8,9,12,13,14]. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
@dance858 this PR is ready for review! |
Collaborator
|
Beautiful code @Transurgeon. Very nice abstraction. Let's remember to test it on the python side when we have bindings and make a new SparseDiffPy release. I'm merging this but creating an issue to remember it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both are thin wrappers that compute flat column-major index arrays and delegate to new_index. diag_mat extracts the diagonal of a square matrix into a vector. upper_tri extracts strict upper triangular elements (excluding diagonal).
Also removes a duplicate new_diag_vec declaration in affine.h.