【问题标题】:Is there support for sparse matrices in Python?Python 中是否支持稀疏矩阵?
【发布时间】:2011-06-05 03:49:48
【问题描述】:

python 中是否支持稀疏矩阵?

可能在 numpy 或 scipy 中?

【问题讨论】:

标签: python numpy scipy sparse-matrix


【解决方案1】:

是的。

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

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

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

【讨论】:

    【解决方案2】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 2015-04-26
      • 2023-04-10
      • 2018-01-19
      相关资源
      最近更新 更多