[SciPy-user] Sparse indexing workarounds

Robert Cimrman cimrman3@ntc.zcu...
Tue Apr 10 03:47:10 CDT 2007

Bill Baxter wrote:
> Does anyone have an easy (and efficient way) to update a submatrix of
> a big sparse matrix?
>   K = scipy.sparse.lil_matrix(bigN,bigN)
>   ...
>   conn = [1,4,11,12]
>   K[ix_(conn,conn)] += elemK
> where elemK is a 4x4 dense matrix.
> This kind of thing is very commonly needed in FEM codes for assembling
> the global stiffness matrix.  But sparse doesn't seem to support
> either += or indexing with the open grid of indices returned by ix_.

You may have a look at
it uses CSR matrix though...


More information about the SciPy-user mailing list