15.12.2012 Views

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Kronecker sum of two sparse matrices is a sum of two Kronecker products kron(I_n,A) + kron(B,I_m) where<br />

A has shape (m,m) and B has shape (n,n) and I_m and I_n are identity matrices of shape (m,m) and (n,n)<br />

respectively.<br />

Parameters<br />

A :<br />

B :<br />

square matrix<br />

square matrix<br />

format : string<br />

format of the result (e.g. “csr”)<br />

Returns<br />

kronecker sum in a sparse matrix format :<br />

lil_eye((r, c), k=0, dtype=’d’)<br />

Generate a lil_matrix of dimensions (r,c) with the k-th diagonal set to 1.<br />

Parameters<br />

r,c : int<br />

k : int<br />

row and column-dimensions of the output.<br />

• diagonal offset. In the output matrix,<br />

• out[m,m+k] == 1 for all m.<br />

dtype : dtype<br />

data-type of the output array.<br />

lil_diags(diags, offsets, (m, n), dtype=’d’)<br />

Generate a lil_matrix with the given diagonals.<br />

Examples<br />

Parameters<br />

diags : list of list of values e.g. [[1,2,3],[4,5]]<br />

values to be placed on each indicated diagonal.<br />

offsets : list of ints<br />

diagonal offsets. This indicates the diagonal on which the given values should be<br />

placed.<br />

(r,c) : tuple of ints<br />

row and column dimensions of the output.<br />

dtype : dtype<br />

output data-type.<br />

>>> lil_diags([[1,2,3],[4,5],[6]],[0,1,2],(3,3)).todense()<br />

matrix([[ 1., 4., 6.],<br />

[ 0., 2., 5.],<br />

[ 0., 0., 3.]])<br />

386 Chapter 3. Reference

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

Saved successfully!

Ooh no, something went wrong!