[SciPy-user] fast max() on sparse matrices
Mon Jan 5 19:04:18 CST 2009
"... 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
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 *
On Mon, Jan 5, 2009 at 5:40 PM, Nathan Bell <firstname.lastname@example.org> wrote:
> On Mon, Jan 5, 2009 at 4:43 PM, nicky van foreest <email@example.com>
> > 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
> Nathan Bell firstname.lastname@example.org
> SciPy-user mailing list
Peter N. Skomoroch
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user