[SciPy-user] Sparse indexing workarounds
Fri Apr 13 23:21:52 CDT 2007
Thanks for the suggestion.
Is there any easy way to print out a pysparse spmatrix or convert it
to a numpy dense matrix?
It seems like the functionality is there in pysparse, but the
interface is a bit maddening. A little more flexibility would be
nice. I guess the interface is unforgiving because it's implemented
in C/C++? But there are lots of little issues like matvec insisting
on having a return parameter, and refusing to work with anything
besides 1D arrays (no automatic conversion of python lists to arrays,
or forgiving treatment of (N,1) or (1,N) arrays as "close enough".
Documentation is quite minimal too... but anyway, if I can get it to
solve my system, and if it's fast, I'll be a happy camper. :-)
On 4/10/07, Håkan Jakobsson <email@example.com> wrote:
> 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 < firstname.lastname@example.org> 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
> > SciPyemail@example.com
> > http://projects.scipy.org/mailman/listinfo/scipy-user
> SciPy-user mailing list
More information about the SciPy-user