[SciPy-user] Sparse matrix: division by vector
Dinesh B Vadhia
dineshbvadhia@hotmail....
Tue Apr 29 12:16:38 CDT 2008
Sparse matrix A is in csr_matrix format and I want to divide each column element j of A by A's column j sum (where colSum is a numpy vector) ie.
> A[:,j] = A[:,j]/colSum[j]
What is the most efficient way to achieve this apart from brute force ie.
> A[i,j] = A[i,j]/colSum[j] ?
I can initially create A in a different c**_matrix method if that helps but the final A has to be in csr_matrix form.
Cheers!
Dinesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080429/ee557117/attachment.html
More information about the SciPy-user
mailing list