[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: email@example.com [firstname.lastname@example.org] on behalf of Brendan Dolan-Gavitt [email@example.com]
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