15.12.2012 Views

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Notes<br />

lil_matrix(D)<br />

with a dense matrix or rank-2 ndarray D<br />

lil_matrix(S)<br />

with another sparse matrix S (equivalent to S.tocsc())<br />

SciPy Reference Guide, Release 0.8.dev<br />

lil_matrix((M, N), [dtype])<br />

to construct an empty matrix with shape (M, N) dtype is optional, defaulting to dtype=’d’.<br />

Advantages of the LIL format<br />

• supports flexible slicing<br />

• changes to the matrix sparsity structure are efficient<br />

Disadvantages of the LIL format<br />

Intended Usage<br />

Data Structure<br />

Methods<br />

• arithmetic operations LIL + LIL are slow (consider CSR or CSC)<br />

• slow column slicing (consider CSC)<br />

• slow matrix vector products (consider CSR or CSC)<br />

• LIL is a convenient format for constructing sparse matrices<br />

• once a matrix has been constructed, convert to CSR or CSC format for fast arithmetic and matrix<br />

vector operations<br />

• consider using the COO format when constructing large matrices<br />

• An array (self.rows) of rows, each of which is a sorted list of column indices of non-zero elements.<br />

• The corresponding nonzero values are stored in similar fashion in self.data.<br />

asformat(format) Return this matrix in a given sparse format<br />

asfptype() Upcast matrix to a floating point format (if necessary)<br />

astype(t)<br />

conj()<br />

conjugate()<br />

copy()<br />

diagonal() Returns the main diagonal of the matrix<br />

dot(*args, **kwds) dot is deprecated!<br />

getH()<br />

get_shape()<br />

getcol(j) Returns a copy of column j of the matrix, as an (m x 1) sparse<br />

getdata(*args, **kwds) getdata is deprecated!<br />

getformat()<br />

getmaxprint()<br />

Continued on next page<br />

3.14. Sparse matrices (<strong>scipy</strong>.sparse) 367

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!