Closed
Conversation
Constants and updatable parameters are now represented by a single parameter_expr node. Constants use param_id == PARAM_FIXED (-1), while updatable parameters use param_id >= 0. Bivariate ops (left_matmul, right_matmul, scalar_mult, vector_mult) accept an optional param_source node and refresh their internal data on forward/jacobian/hessian evaluation. Adds problem_register_params and problem_update_params for problem-level parameter management. Also adds update_values to the Matrix interface for parameter refresh. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove redundant refresh_param_values calls from eval_jacobian and eval_wsum_hess in left_matmul (forward always runs first) - Use memcpy in problem_register_params for pointer array copy - Add PARAM_FIXED guard in problem_update_params to skip fixed constants - Remove unused right_matmul_expr struct from subexpr.h - Add test_param_fixed_skip_in_update covering mixed fixed/updatable params - Add CLAUDE.md for Claude Code guidance Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolves conflicts from main's workspace refactor (iwork/dwork -> work->), elementwise atom split (elementwise_univariate -> full_dom/restricted_dom), chain rule refactor, vstack addition, and numerical diff checker. Removed stale test_jacobian_composite_log tests (incompatible with main's chain rule refactor; covered by test_chain_rule_jacobian and numerical diff). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolves conflicts from folder structure refactor (#63) and more tests (#62). Moves scalar_mult/vector_mult to src/affine/ and test files to new subdirectory structure. Updates affine.h declarations with parameter support signatures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve merge conflicts in parameter.c and scalar_mult.c: keep parameter-support-v2 features (parameter_expr, param_id, free_type_data) while adopting _impl suffix naming from main. Fix old 2-arg new_left_matmul calls in test_chain_rule_jacobian.h to use new 3-arg signature with NULL param_node. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve conflicts from matmul chain rule PR (#67): - subexpr.h: keep both vector_mult_expr and new matmul_expr/const types - dense_matrix.c: adopt shared I_kron_A functions, keep update_values - Add missing dense_matrix.h include in right_matmul.c - Update new matmul tests to use 3-arg left_matmul signature Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts: # src/affine/const_scalar_mult.c # src/affine/const_vector_mult.c # src/affine/constant.c # src/atoms/affine/const_scalar_mult.c # src/atoms/affine/const_vector_mult.c # src/atoms/affine/constant.c # src/atoms/affine/parameter.c # src/atoms/affine/right_matmul.c # src/atoms/affine/scalar_mult.c # src/atoms/affine/vector_mult.c # tests/jacobian_tests/affine/test_scalar_mult.h # tests/jacobian_tests/affine/test_vector_mult.h # tests/wsum_hess/affine/test_scalar_mult.h # tests/wsum_hess/affine/test_vector_mult.h
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve conflicts from tracked allocation PR (#70): use SP_CALLOC/SP_MALLOC macros in parameter-support files while keeping parameter-specific types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CVXPY sends parameter values in Fortran (column-major) order, but the matmul refresh functions assumed row-major/CSR order via raw memcpy. This produced incorrect matrix values for non-symmetric matrices. For sparse matrices, iterate the CSR pattern and index into the column-major source array. For dense matrices, exploit the fact that column-major A is row-major A^T to memcpy directly into AT, then transpose to get A. Also fixes a latent bug where sparse update_values would blindly copy the first nnz values from the full d1*d2 parameter array, which is wrong for matrices with structural zeros. Adds tests for rectangular (3x2) and sparse (3x3 with zeros) cases. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
this is a duplicate PR of #72 .. we can close it (but this has the full changes from main.. so maybe worth keeping until we merge the other PRs). |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
Author
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.
This PR fixes the refresh_param_values functions to read the parameter values as if they were flattened in column order (which is actually always the case for CVXPY/DNLP). The changes should be minimal and quite clean.
There are still some questions about the sparse parameters, but maybe let's revisit that at a later time.
Currently it will still form a "dense" parameter vector since it takes the shape of the array. I made it so that we select the correct values in column-order, but it won't be as efficient since we might still need to go through all the structural zeros.