pydata / sparse

Sparse multi-dimensional arrays for the PyData ecosystem
https://sparse.pydata.org
BSD 3-Clause "New" or "Revised" License
585 stars 125 forks source link

BUG: Fix CSR/CSC matmul #660

Closed mtsokol closed 5 months ago

mtsokol commented 5 months ago

Hi @hameerabbasi,

I noticed that matmul for CSR/CSC in sparse is broken:

import sparse
import scipy.sparse as sps

arr_csr = sps.random_array((10, 10), format='csr')
sparse_csr = sparse._compressed.CSR.from_scipy_sparse(arr_csr)

sparse_csr @ sparse_csr

throws a ValueError. This PR fixes transpose for _compressed 2D formats.

github-actions[bot] commented 5 months ago

Test Results

5 913 tests  +8   5 880 :white_check_mark: +9   7m 2s :stopwatch: +43s     1 suites ±0      33 :zzz:  - 1      1 files   ±0       0 :x: ±0 

Results for commit 833e3b13. ± Comparison against base commit 18c1596f.

This pull request skips 2 and un-skips 3 tests. ``` sparse.pydata_backend.tests.test_coo ‑ test_reductions_float16[i4-None-sum-kwargs0] sparse.pydata_backend.tests.test_coo ‑ test_reductions_float16[i8-None-sum-kwargs0] ``` ``` sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[f4-None-sum-kwargs0] sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[i4-None-mean-kwargs1] sparse.pydata_backend.tests.test_compressed ‑ test_reductions_float16[i8-None-sum-kwargs0] ```

:recycle: This comment has been updated with latest results.

hameerabbasi commented 5 months ago

Thanks for the fix, @mtsokol!