[SciPy-user] Initializing COO/CSR matrix before function call
David Warde-Farley
dwf at cs.toronto.edu
Sun Feb 3 00:20:50 EST 2008
Dinesh,
What sort of method are you using to load the matrices? It'd help if
you posted some code. In general you shouldn't have to initialize
something too big in order to load in a sparse matrix. I'm not sure
that COO is terribly efficient for on-the-fly insertions. Maybe a
dok_matrix would be more appropriate, which you can then convert to
whatever you need, all at once, as then you'll know exactly how many
non-zero elements you have to allocate space for.
David
On 2-Feb-08, at 11:16 PM, Dinesh B Vadhia wrote:
> I'm using a function to load a sparse matrix A using coo_matrix and
> then to transform it into a csr_matrix. We are testing a bunch of
> very large sized matrices A and hence the use of a function. In
> addition, A is available to many other functions in the program.
>
> Python says that A has to be defined (or initialized) before sending
> to the load function. But, doesn't that mean initializing A as
> 'empty' or 'zeroed', both of which impact memory use, defeats the
> purpose of using coo and csr? I've looked at the Sparse docstring
> help and cannot see a way out.
>
> Have I missed something?
>
> Dinesh
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20080203/d3e9aaa2/attachment.html>
More information about the SciPy-User
mailing list