Repository navigation
problem: build the Lagrange Hessian with sum_n_matrices_* - #163
Merged
Merged
Conversation
Replace problem_lagrange_hess_fill_sparsity, hess_idx_map and the accumulator loop with sum_n_matrices_alloc / fill_zero / fill_add. lagrange_hessian stays a CSR_matrix *, now the CSR view of hess_sum. Each Hessian is added right after it is evaluated, so constraints that share a subexpression no longer sum overwritten values. Affine constraints, whose Hessian is zero, skip the add. problem.c no longer uses accumulator, compose_csr_idx_map_for_spd or csr_kernels.h. Co-Authored-By: Claude Opus 5.5 <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.
Moves
problem.c's Lagrange Hessian assembly onto the library'ssum_n_matrices_alloc/sum_n_matrices_fill_zero/sum_n_matrices_fill_add. The library is unchanged and the pin stays atcba21ac.Changes
problem_lagrange_hess_fill_sparsity(about 90 lines),hess_idx_mapand theaccumulatorloop.lagrange_hessian: stays aCSR_matrix *, now the CSR view of the newhess_sum. The view is not a copy, andfree_problemfreeshess_sum. The bindings, the COO path and the tests don't change.test_problem_hessian_shared_subexpruses constraintslog(x)andexp(log(x))with the samelog(x)node. On the old code it fails with-4where-1is correct.problem.cno longer usesaccumulator,compose_csr_idx_map_for_spdorcsr_kernels.h. That clears the way for a library PR making them private.Performance
Old
mainvs this branch, both Release, 5 interleaved runs. The Hessian checksums are identical.Testing
SP_TRACK_MEMORYbuild.leaks --atExitreports 0 leaks.🤖 Generated with Claude Code