Unverified Commit 6897f55a authored by IzabelaMazur's avatar IzabelaMazur Committed by GitHub
Browse files

[Performance]: Remove indptr correction for CooToCSR (#2356)

parent 00edb949
......@@ -341,6 +341,7 @@ CSRMatrix COOToCSR(COOMatrix coo) {
} else {
// compute indptr
IdType* Bp = static_cast<IdType*>(ret_indptr->data);
*(Bp++) = 0;
std::fill(Bp, Bp + N, 0);
for (int64_t i = 0; i < NNZ; ++i) {
Bp[row_data[i]]++;
......@@ -352,7 +353,6 @@ CSRMatrix COOToCSR(COOMatrix coo) {
Bp[i] = cumsum;
cumsum += temp;
}
Bp[N] = NNZ;
// compute indices and data
ret_indices = NDArray::Empty({NNZ}, coo.row->dtype, coo.row->ctx);
......@@ -366,13 +366,6 @@ CSRMatrix COOToCSR(COOMatrix coo) {
Bx[Bp[r]] = data? data[i] : i;
Bp[r]++;
}
// correct the indptr
for (int64_t i = 0, last = 0; i <= N; ++i) {
IdType temp = Bp[i];
Bp[i] = last;
last = temp;
}
}
return CSRMatrix(coo.num_rows, coo.num_cols,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment