[SciPy-user] fast max() on sparse matrices

Peter Skomoroch peter.skomoroch@gmail....
Tue Jan 6 11:58:29 CST 2009


Nathan,

Thanks for all the help, the sparse module is pretty powerful stuff.  I'll
pull together a small scale example and post it tonight.

-Pete

On Mon, Jan 5, 2009 at 8:42 PM, Nathan Bell <wnbell@gmail.com> wrote:

> On Mon, Jan 5, 2009 at 8:04 PM, Peter Skomoroch
> <peter.skomoroch@gmail.com> wrote:
> > Nathan,
> >
> > You said:
> >
> >  "... some matrices permit duplicate entries.
> > Currently, we implicitly sum duplicate values together (e.g. when
> > computing sparse matrix-vector products) and when converting to other
> > formats."
> >
> > Could you elaborate on that a bit?  I'm trying to track down a nasty bug
> > right now where the result of a sparse matrix-matrix product (A_sparse *
> > B_dense) does not agree with the corresponding dense product (A_dense *
> > B_dense).
> >
>
> It's a little costly to detect the presence of duplicates in the CSR,
> CSC, and COO formats so we adopt the convention that a matrix with
> duplicates should behave as if those duplicates were summed together.
> If A and B are sparse matrices then A * B should be close to
> dot(A.toarray(), B.toarray()).  The only difference between the two
> would be due to to order of operations.
>
> Note that there's another oddity w.r.t. sorting of the indices in the
> CSR/CSC formats.  Certain operations will shuffle the nonzeros about,
> so it's dangerous to share arrays between multiple CSR/CSC matrices.
>
> I suspect Robert's suggestion might be the source of your problems.
> If not, try to reduce the problem to something small and reproduceable
> and we'll try to sort it out.
>
> --
> Nathan Bell wnbell@gmail.com
> http://graphics.cs.uiuc.edu/~wnbell/<http://graphics.cs.uiuc.edu/%7Ewnbell/>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>



-- 
Peter N. Skomoroch
peter.skomoroch@gmail.com
http://www.datawrangling.com
http://del.icio.us/pskomoroch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20090106/f3c64ecd/attachment.html 


More information about the SciPy-user mailing list