Skip to content

Allow users to construct decoders with sparse parity check matrix#440

Draft
bmhowe23 wants to merge 11 commits intoNVIDIA:mainfrom
bmhowe23:pr-sparse-binary-matrix
Draft

Allow users to construct decoders with sparse parity check matrix#440
bmhowe23 wants to merge 11 commits intoNVIDIA:mainfrom
bmhowe23:pr-sparse-binary-matrix

Conversation

@bmhowe23
Copy link
Copy Markdown
Collaborator

@bmhowe23 bmhowe23 commented Feb 12, 2026

Related: #379

Note: before merging, consider breaking change effects further and prepare a separate docs update PR.

Signed-off-by: Ben Howe <bhowe@nvidia.com>
…nitializations

Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Ben Howe <bhowe@nvidia.com>
This reverts commit 9df0571.

Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Ben Howe <bhowe@nvidia.com>
@bmhowe23 bmhowe23 added the breaking change Change breaks backwards compatibility label Feb 12, 2026
bmhowe23 and others added 3 commits February 12, 2026 15:04
I, Ben Howe <bhowe@nvidia.com>, hereby add my Signed-off-by to this commit: 9df0571

Signed-off-by: Ben Howe <bhowe@nvidia.com>
Signed-off-by: Ben Howe <bhowe@nvidia.com>
@bmhowe23 bmhowe23 marked this pull request as draft April 6, 2026 21:20
// ============================================================================

trt_decoder::trt_decoder(const cudaqx::tensor<uint8_t> &H,
trt_decoder::trt_decoder(const cudaq::qec::sparse_binary_matrix &H,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this change break downstream users? Since inputs now need to be explicitly wrapped, this could introduce friction. If backward compatibility is important, it might be worth adding a temporary overload that accepts a tensor and converts internally.

/// @param col_ptrs Column pointer array (length num_cols + 1); column j has
/// indices in \p row_indices[col_ptrs[j] .. col_ptrs[j+1]-1].
/// @param row_indices Row indices of non-zeros (length nnz).
static sparse_binary_matrix from_csc(index_type num_rows, index_type num_cols,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like from_csc / from_csr don’t validate inputs currently. It might be worth checking things like pointer array sizes (col_ptrs, row_ptrs), index bounds, and monotonicity of the pointer arrays. If not malformed inputs could lead to subtle bugs or out-of-bounds access later.

for (std::size_t c = 0; c < block_size; c++)
syndrome ^= (c != qErr) && H.at({r, c});
for (std::uint32_t c : H_e2d[qErr])
syndrome ^= 1;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the logic changed from the old code. The old version XORed all columns except qErr, while the new one only toggles non-zeros in column qErr. The new version seems more aligned with a standard LUT but just wanted to confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Change breaks backwards compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants