Python 中是否支持稀疏矩阵?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4623800/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 16:34:27  来源:igfitidea点击:

Is there support for sparse matrices in Python?

pythonnumpyscipysparse-matrix

提问by user566621

Is there support for sparse matrices in python?

python 中是否支持稀疏矩阵?

Possibly in numpy or in scipy?

可能在 numpy 或 scipy 中?

回答by Steve Tjoa

Yes.

是的。

SciPi provides scipy.sparse, a "2-D sparse matrix package for numeric data".

SciPi 提供scipy.sparse,一个“用于数值数据的二维稀疏矩阵包”。

There are seven available sparse matrix types:

  1. csc_matrix: Compressed Sparse Column format
  2. csr_matrix: Compressed Sparse Row format
  3. bsr_matrix: Block Sparse Row format
  4. lil_matrix: List of Lists format
  5. dok_matrix: Dictionary of Keys format
  6. coo_matrix: COOrdinate format (aka IJV, triplet format)
  7. dia_matrix: DIAgonal format

有七种可用的稀疏矩阵类型:

  1. csc_matrix:压缩稀疏列格式
  2. csr_matrix:压缩稀疏行格式
  3. bsr_matrix:块稀疏行格式
  4. lil_matrix:列表格式列表
  5. dok_matrix:键格式字典
  6. coo_matrix:坐标格式(又名 IJV,三元组格式)
  7. dia_matrix:对角线格式

回答by kros