Scipy sparse matrices - purpose and usage of different implementations

前端 未结 1 1503
野性不改
野性不改 2021-01-30 17:14

Scipy has many different types of sparse matrices available. What are the most important differences between these types, and what is the difference in their intended usage? <

相关标签:
1条回答
  • 2021-01-30 17:40

    Sorry if I'm not answering this completely enough, but hopefully I can provide some insight.

    CSC (Compressed Sparse Column) and CSR (Compressed Sparse Row) are more compact and efficient, but difficult to construct "from scratch". Coo (Coordinate) and DOK (Dictionary of Keys) are easier to construct, and can then be converted to CSC or CSR via matrix.tocsc() or matrix.tocsr().

    CSC is more efficient at accessing column-vectors or column operations, generally, as it is stored as arrays of columns and their value at each row.

    CSR matrices are the opposite; stored as arrays of rows and their values at each column, and are more efficient at accessing row-vectors or row operations.

    0 讨论(0)
提交回复
热议问题