[SciPy-User] Efficiently adding a vector to every row of a sparse CSR matrix?
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.
From: firstname.lastname@example.org [email@example.com] on behalf of Brendan Dolan-Gavitt [firstname.lastname@example.org]
Sent: Wednesday, March 06, 2013 6:00 PM
Subject: [SciPy-User] Efficiently adding a vector to every row of a sparse CSR matrix?
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...
More information about the SciPy-User