Support reading SDPA files with multiple LP blocks - #25
Open
f-fr wants to merge 2 commits into
Open
Conversation
added 2 commits
August 30, 2026 14:24
Multiple LP blocks (indicated by negative block sizes) are supported by the SDPA file format but not the reader. This change modifies the reader such that multiple LP blocks are read as if they were a single block: each element "v b i j x" is interpreted as "v b (i + blockoffsets[b]) (j + blockoffsets[b]) x" where "blockoffsets[b]" is the sum of the block sizes of all preceding LP blocks. This effectively reads LP blocks (i.e. diagonal block) as one single diagonal block.
Member
|
Thank you. This is great! Since I cannot write to this pull request, I created a copy #26 . There I added two tests for block indices outside of the range (in order to make the unit test |
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.
Some SDPA files (generated by other tools) may contain multiple LP blocks, but SCIP-SDP only allows for a single LP block. Converting such instances by merging the multiple blocks into a single block is tedious, so this change modifies the reader such that multiple blocks are supported.
The basic changes are as follows:
blockoffsetsandnewblockidxare added to the data struct,idxlinconsblockis removedblockoffsets[b]contains the offset of LP-blockb. This equals the sum of the sizes of all preceding LP blocks. An element at(row, col)of blockbis then interpreted as(row + blockoffsets[b], col + blockoffsets[b])of the single (merged) LP block.newblockidx[b]contains the new block index of each SDP blockb. This equals the old index minus the number of the preceding LP blocks (formerly the index shift was implemented w.r.t. the single LP block, now there may be several LP blocks). For an LP blocknewblockidx[b] == -1(this is how LP blocks are recognized).