From 1bf3d6e27267a9575a7f7a3c7745a6ea99e73568 Mon Sep 17 00:00:00 2001 From: Riley Murray Date: Wed, 23 Oct 2024 22:45:10 -0400 Subject: [PATCH] Fix bugs in undocumented sparse matrix conversion functions I'll add tests before merging this PR. But I want to note these necessary changes now as I'm discovering them. --- RandBLAS/sparse_data/conversions.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RandBLAS/sparse_data/conversions.hh b/RandBLAS/sparse_data/conversions.hh index cb4958be..3830ea1b 100644 --- a/RandBLAS/sparse_data/conversions.hh +++ b/RandBLAS/sparse_data/conversions.hh @@ -72,7 +72,7 @@ void csc_to_coo(CSCMatrix &csc, COOMatrix &coo) { for (int64_t j = 0; j < csc.n_cols; ++j) { for (int64_t i = csc.colptr[j]; i < csc.colptr[j+1]; ++i) { coo.vals[ell] = csc.vals[ell]; - coo.rows[ell] = (sint_t2) i; + coo.rows[ell] = (sint_t2) csc.rowidxs[i]; coo.cols[ell] = (sint_t2) j; ++ell; } @@ -114,7 +114,7 @@ void csr_to_coo(CSRMatrix &csr, COOMatrix &coo) { for (int64_t j = csr.rowptr[i]; j < csr.rowptr[i+1]; ++j) { coo.vals[ell] = csr.vals[ell]; coo.rows[ell] = (sint_t2) i; - coo.cols[ell] = (sint_t2) j; + coo.cols[ell] = (sint_t2) csr.colidxs[j]; ++ell; } }