[SciPy-user] more help with sparse matrix: creating

Robin robince at gmail.com
Mon Oct 8 04:19:51 EDT 2007


Hi,

I have to generate a large sparse matrix. I can't generate it all at once,
but I do know the number of nnz it will contain.

In MATLAB I first allocate the sparse matrix structure
A     = sparse([],[],1,dim,dim,Annz);
And then fill it at my leisure with normal slicing.

How would I achieve a similar thing in numpy (to first allocate with fixed
nnz, then fill in sections), preferably with slicing/fancy indexing?
(I was reading about lil_matrix etc. but it wasn't clear to me how to do the
above)

Thanks,

Robin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20071008/168ba96e/attachment.html>


More information about the SciPy-User mailing list