5

I was wondering what the algorithmic complexity of a conversion from CSC (compressed sparse column) to CSR (compressed sparse row) is?

Say I have

  • a CSC m x m-matrix A = csc(m,m) with n non-zero elements
  • a CSR m x m-matrix B = csr(m,m) with n non-zero elements

Now I do the conversion from CSC -> CSR with B = convert(A).


How costly and complex is it? Can anyone guide me through it? Or clarify things? Thanks

Armen Avetisyan
  • 1,140
  • 10
  • 29
  • 1
    Scipy (**the** basic numerical computation package for python along numpy) docs [here](https://docs.scipy.org/doc/scipy-0.18.1/reference/sparse.html#usage-information): ```All conversions among the CSR, CSC, and COO formats are efficient, linear-time operations.``` (probably meaning linear-time in NNZ-size) – sascha Jan 11 '17 at 22:59

1 Answers1

5

Following up on @sascha's comment:

Complexity: Linear. Specifically O(nnz(A) + max(n_row,n_col))

Taken from the scipy source code. It does not matter whether you compute CSC -> CSR or CSR -> CSC (see here).

asPlankBridge
  • 1,032
  • 1
  • 17
  • 30