Fix Eigen interface: general Hessian workspace allocation and add time_limit setting - #129
Merged
Merged
Conversation
…e_limit setting Co-authored-by: darnstrom <55484604+darnstrom@users.noreply.github.com> Agent-Logs-Url: https://github.com/darnstrom/daqp/sessions/8b7553d3-d02f-431b-8f7e-691679583cea
Copilot
AI
changed the title
[WIP] Fix eigen interface for general Hessian and add time limit setting
Fix Eigen interface: general Hessian workspace allocation and add time_limit setting
Mar 21, 2026
darnstrom
marked this pull request as ready for review
March 21, 2026 09:41
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.
The
DAQPworkspace class was broken for non-identity Hessians becauseallocate_daqp_ldpwas called withalloc_R=0, alloc_v=0, leavingwork_.Rinv = nullptr. Any call toupdate(H, ...)with a non-identityHwould crash insidedaqp_update_Rinvwriting to a null pointer. Additionally, the default update mask always includedDAQP_UPDATE_Rinveven whenHwas null, causing a null dereference in the other direction.Changes
Pre-allocate Rinv/v buffers —
allocate_daqp_ldpnow called withalloc_R=1, alloc_v=1. Two new private membersrinv_buf_/v_buf_hold the raw pointers.Buffer visibility management in
update()—daqp.cusesRinv != nullptrto detect non-identity Hessian. The buffers are exposed (work_.Rinv = rinv_buf_) only whenHis provided, and hidden (nullptr) otherwise to preserve correct LDP/identity-Hessian behavior:Fix default update mask —
DAQP_UPDATE_Rinv/DAQP_UPDATE_vare only added to the default mask whenH/fare actually provided.Destructor cleanup — restores buffer pointers into
work_.Rinvbeforefree_daqp_ldpto avoid leaking the pre-allocated memory when in LDP mode (where bothRinvandRinvDare null).Add
set_time_limit(double val)— mirrors all other settings setters; was the onlyDAQPSettingsfield without a corresponding setter in the Eigen interface.New test
06_general_hessian— validates the workspace class with a non-identityH, comparing against the statelessdaqp_solve()reference.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.