Allow users to construct decoders with sparse parity check matrix#440
Allow users to construct decoders with sparse parity check matrix#440bmhowe23 wants to merge 11 commits intoNVIDIA:mainfrom
Conversation
Signed-off-by: Ben Howe <bhowe@nvidia.com>
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>
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>
| // ============================================================================ | ||
|
|
||
| trt_decoder::trt_decoder(const cudaqx::tensor<uint8_t> &H, | ||
| trt_decoder::trt_decoder(const cudaq::qec::sparse_binary_matrix &H, |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
Related: #379
Note: before merging, consider breaking change effects further and prepare a separate docs update PR.