[SciPy-User] Efficiently adding a vector to every row of a sparse CSR matrix?

Fraser, Andy afraser@lanl....
Thu Mar 7 22:42:24 CST 2013


If you don't need the 500000x65536 result as a stored object but can use the results one at a time, you can write a function that digs into the internal representation of the sparse matrix and "yields" the result (I think as an iterator).  If you use cython, it will be pretty fast.  Let me know if that approach will help.  If so, I can make a more detailed suggestion.

Andy
________________________________
From: scipy-user-bounces@scipy.org [scipy-user-bounces@scipy.org] on behalf of Brendan Dolan-Gavitt [mooyix@gmail.com]
Sent: Wednesday, March 06, 2013 6:00 PM
To: scipy-user@scipy.org
Subject: [SciPy-User] Efficiently adding a vector to every row of a sparse CSR matrix?

Hi,

As part of implementing a batch calculation of Jensen-Shannon divergence, I need to take a (sparse) 65536-element vector "V" and add it to every row of a (sparse) 500000x65536 matrix "O" of observations. [...]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20130308/763ee2c1/attachment.html 


More information about the SciPy-User mailing list