Pythonの疎行列はScipy.sparseに入っているようです。
ただし、幾つか疎行列にはいくつか種類があるようで、目的に応じて
使い分けたりconvertするのが良いようです。
疎行列の作成
これにはRow-based Linked List形式のsparse.lil_matrixが良いようです。
作り方はやはりサイズをtupleにして入れるみたいですね。
>>> from numpy import zeros
>>> from scipy import sparse
>>> A = zeros( (3,4) ) # dense matrix
>>> B = sparse.lil_matrix( (3,4) ) # sparse LIL matrix
>>> A[1][2] = 3 # OK
>>> A[2, 2] = 1 # OK
>>> B[1][2] = 3 # NG
IndexError: invalid index
>>> B[1, 2] = 3 # OK
>>> B[2, 2] = 1
>>> print A
[ [ 0. 0. 0. 0. ]
[ 0. 0. 3. 0. ]
[ 0. 0. 1. 0. ] ]
>>> print B
(1, 2) 3.0
(2, 2) 1.0
>>> C = B.todense() # make it dense
>>> print C
[ [ 0. 0. 0. 0. ]
[ 0. 0. 3. 0. ]
[ 0. 0. 1. 0. ] ]
大きい疎行列の作成
これにはCoordinate形式のsprase.coo_matrixが良いようです。
非ゼロ要素へのシーケンシャルアクセス
これにはcoo_matrixを使った方法が早いとありますね。
python - Iterating through a scipy.sparse vector (or matrix) - Stack Overflow
実際にやってみましょう。
疎行列を用いた計算
これには上記の行列をCompressed Sparse Column形式(CSC)あるいは
Compressed Sparse Row形式(CRC)に変換します。
sparse.csc_matrixあるいはsparse.crc_matrixに統一して
計算するのが良いようです。