コンテンツにスキップ

疎行列

出典: フリー百科事典『ウィキペディア(Wikipedia)』
疎行列の例

上の疎行列には非ゼロ要素が9個しかなく、ゼロ要素は26個ある。スパース性は74%であり、密度は26%である。

2次元の有限要素問題を説いた時に得られる疎行列。非ゼロ要素を黒で表している。

: sparse matrix: sparse array[1]dense[1]sparsity

1

使[2][3]使



CPUGPGPU[4][ 1]

[]


2ai,j2ijijm × nm × n





2


DOKDictionary of keys

LILList of lists

COO


CSR

CSC

BSR: Block Sparse matrix

Netlib使[5]Intel Math Kernel Library[6]SciPy使A

Dictionary of Key[]


Dictionary of KeyDOK(, ) 

[]


: List of lists, LIL (, ) 

[]


: Coordinate, COO [, , ] [7]

A
A  = [1 2 3 0 0 0 0 1 2 0 0 2 0 0 0 1] # 値
IA = [1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4] # 行インデックス
JA = [1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4] # 列インデックス


A  = [1 2 3 1 2 2 1] # 値
IA = [1 1 1 2 3 3 4] # 行インデックス
JA = [1 2 3 4 1 4 4] # 列インデックス

ACOO

COO

[]


: Compressed Row Storage, CRS Compressed Sparse RowCSR[8]

CSR2
data = [1 2 3 1 2 2 1] # 値
IA   = [1 1 1 2 3 3 4] # 行インデックス
JA   = [1 2 3 4 1 4 4] # 列インデックス

IA IA[1] = IA[2] = IA[3] = 11124IA[1:4]=[1 1 1]CSR

headindptr = [ptr_row_1 ptr_row2 ...]JAindices[9]
data    = [1 2 3 1 2 2 1] # 値
indices = [1 2 3 4 1 4 4] # 列インデックス
indptr  = [1 4 5 7]       # 行Headポインタ

ACSR

CSR[10]1 data[indptr[1]:indptr[2]]  indices[indptr[1]:indptr[2]] 1[9]COOIAIA[k] == 1kdata[k], indices[k]k

CSR[11]1indicesindices[k] == 1kindptrkindptr[n] <= k <indptr[n+1]n

[]


: Compressed Column Storage, CCSCRS Compressed Sparse Column (CSC) [12]

[]


Compressed Diagonal StorageCDSDiagonalDIACRSCSR 

SKSSKY[]



[]


: Block Compressed Row Storage, BCRSCRS Block Sparse Row (BSR) [13]

関連項目[編集]

外部リンク[編集]

脚注[編集]

注釈[編集]

  1. ^ 疎行列にアクセスする際に行われる、巨大な配列データを大域的にインデックス参照で引いてくるランダムメモリアクセスを多用する操作は、一般的なスカラ型のCPUやGPGPUにとっては苦手な処理である。

出典[編集]



(一)^ abYan, Di; Wu, Tao; Liu, Ying; Gao, Yang (2017). An efficient sparse-dense matrix multiplication on a multicore system. IEEE. doi:10.1109/icct.2017.8359956. ISBN 978-1-5090-3944-9. The computation kernel of DNN is large sparse-dense matrix multiplication. In the field of numerical analysis, a sparse matrix is a matrix populated primarily with zeros as elements of the table. By contrast, if the number of non-zero elements in a matrix is relatively large, then it is commonly considered a dense matrix. The fraction of zero elements (non-zero elements) in a matrix is called the sparsity (density). Operations using standard dense-matrix structures and algorithms are relatively slow and consume large amounts of memory when applied to large sparse matrices.

(二)^ "Argonne National Laboratory Deploys Cerebras CS-1, the World's Fastest Artificial Intelligence Computer | Argonne National Laboratory". www.anl.gov (Press release) (). 2019122The WSE is the largest chip ever made at 46,225 square millimeters in area, it is 56.7 times larger than the largest graphics processing unit. It contains 78 times more AI optimized compute cores, 3,000 times more high speed, on-chip memory, 10,000 times more memory bandwidth, and 33,000 times more communication bandwidth.

(三)^ Cerebras Systems Unveils the Industry's First Trillion Transistor Chip (). www.businesswire.com (2019819). 2019122 The WSE contains 400,000 AI-optimized compute cores. Called SLAC for Sparse Linear Algebra Cores, the compute cores are flexible, programmable, and optimized for the sparse linear algebra that underpins all neural network computation

(四)^  4  |  NSITEXE,Inc. (2023222). 2023618

(五)^ Survey of Sparse Matrix Storage Formats

(六)^ Intel® MKL Sparse BLAS Overview | Intel® Developer Zone

(七)^ "scipy.sparse.coo_matrix ... A sparse matrix in COOrdinate format." scipy.sparse.coo_matrix. scipy. 2022-03-05.

(八)^ "scipy.sparse.csr_matrix ... Compressed Sparse Row matrix" scipy.sparse.csr_matrix. scipy. 2022-03-05.

(九)^ ab"csr_matrix((data, indices, indptr) ... is the standard CSR representation where the column indices for row i are stored in indices[indptr[i]:indptr[i+1]] and their corresponding values are stored in data[indptr[i]:indptr[i+1]]." scipy.sparse.csr_matrix. scipy. 2022-03-05.

(十)^ "Advantages of the CSR format ... efficient row slicing" scipy.sparse.csr_matrix. scipy. 2022-03-05.

(11)^ "Disadvantages of the CSR format slow column slicing operations" scipy.sparse.csr_matrix. scipy. 2022-03-05.

(12)^ "scipy.sparse.csc_matrix ... Compressed Sparse Column matrix" scipy.sparse.csc_matrix. scipy. 2022-03-05. 

(13)^ "scipy.sparse.bsr_matrix ... Block Sparse Row matrix" scipy.sparse.bsr_matrix. 2022-03-05.