quantumgizmos / ldpc

Software for decoding classical and quantum codes
MIT License
80 stars 28 forks source link

[BUG] `row_echelon` not working as expected for sparse arrays #13

Closed bestquark closed 3 weeks ago

bestquark commented 2 years ago

Hello! The row_echelon function is not working for sparse matrices or arrays as expected.

For example, this would fail

x = csr_array([[1,2], [2,1]])
mod2.row_echelon(x)

I get NotImplementedError: We have not yet implemented 1D sparse slices; please index using explicit indices, e.g. 'x[:, [0]]'

I can try fixing it too!

quantumgizmos commented 2 years ago

Hi Luis. Thanks for highlighting this bug. I wrote these functions with numpy matrices in mind, although implementing scipy.sparse compatible versions would be very useful. I'm current working on refactoring the package so will try to include this as a feature. If you figure it out in the meantime, please submit a pull request. Thanks Joschka