[WIP] Unify constants and parameters into single parameter_expr type#53
Open
Transurgeon wants to merge 8 commits intomainfrom
Open
[WIP] Unify constants and parameters into single parameter_expr type#53Transurgeon wants to merge 8 commits intomainfrom
Transurgeon wants to merge 8 commits intomainfrom
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>
dance858
reviewed
Mar 26, 2026
dance858
reviewed
Mar 26, 2026
dance858
reviewed
Mar 26, 2026
dance858
reviewed
Mar 26, 2026
- 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>
Collaborator
Author
|
@dance858 I synced the PR with master, then addressed your comments. Please have another look. |
Collaborator
Thanks for looking into the comments. Let me know when you have added tests on the python side and we'll merge this nice PR. Also, sorry for the refactoring which forces you to sync this PR... But in the long run the refactoring is good. |
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>
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.
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.
▎ - Unifies constants and updatable parameters into a single parameter_expr type (param_id == PARAM_FIXED for constants, >= 0 for updatable parameters)
▎ - Adds update_values to the Matrix interface for parameter refresh (sparse and dense)
▎ - Makes left_matmul, right_matmul, scalar_mult, and vector_mult parameter-aware via optional param_source pointer
▎ - Adds problem_register_params / problem_update_params for problem-level parameter management
▎ - Renames constant.c → parameter.c, const_scalar_mult.c → scalar_mult.c, const_vector_mult.c → vector_mult.c
▎ Test plan
▎ - All 196 existing tests pass (API updated to new signatures)
▎ - 4 new parameter problem-level tests: scalar_mult, vector_mult, left_matmul, right_matmul — each verifies correct evaluation after parameter update
▎ - clang-format clean