[SciPy-user] Sparse indexing workarounds

Håkan Jakobsson hakan.jakobsson at gmail.com
Tue Apr 10 05:11:51 EDT 2007


You can use pysparse instead of sparse. The update_add_mask function will do
the trick.
/Håkan J

On 4/10/07, Robert Cimrman <cimrman3 at ntc.zcu.cz> wrote:
>
> 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
> http://ui505p06-mbs.ntc.zcu.cz/sfe/FEUtilsExample
> it uses CSR matrix though...
>
> r.
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20070410/d3efd603/attachment.html>


More information about the SciPy-User mailing list