[SciPy-user] fast max() on sparse matrices
Peter Skomoroch
peter.skomoroch@gmail....
Mon Jan 5 19:04:18 CST 2009
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).
-Pete
On Mon, Jan 5, 2009 at 5:40 PM, Nathan Bell <wnbell@gmail.com> wrote:
> On Mon, Jan 5, 2009 at 4:43 PM, nicky van foreest <vanforeest@gmail.com>
> wrote:
> >
> > A few days ago I encountered just the same problem, and solved by
> > taking the max of the values(), just as suggested below. However, it
> > took me some minutes to fiugre this out, and I first, of course, tried
> > the max() function. Thus, I suggest that the max function will be
> > added to the sparse class. Is there a reason not to do so?
> >
>
> Hi Nicky,
>
> It should be added, but it's not as straightforward as you might think.
>
> For conformity with dense matrices, max() should return zero if the
> nonzero entries of the matrix are all negative and there is at least
> one missing value in the matrix. This might surprise people who
> expect the largest nonzero value instead. For instance,
> csr_matrix([[0,-1]]).max() should be 0.
>
> Another minor problem is that 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. We'd probably want to make max() and min() agree with this
> behavior.
>
> --
> 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/20090105/d9594e78/attachment.html
More information about the SciPy-user
mailing list