[SciPy-User] Can I copy a sparse matrix into an existing dense numpy matrix?
Conrad Lee
conradlee@gmail....
Sun Feb 5 09:05:39 CST 2012
Say I have a huge numpy matrix *A* taking up tens of gigabytes. It takes a
non-negligible amount of time to allocate this memory.
Let's say I also have a collection of scipy sparse matrices with the same
dimensions as the numpy matrix. Sometimes I want to convert one of these
sparse matrices into a dense matrix to perform some vectorized operations
that can't be performed on sparse matrices.
Can I load one of these sparse matrices into *A* rather than re-allocate
space each time I want to convert a sparse matrix into a dense matrix? The
.toarray() and .todense() methods which are available on scipy sparse
matrices do not seem to take an optional dense array argument, but maybe
there is some other way to do this.
(I've also started a stackoverflow version of this question
here<http://stackoverflow.com/questions/9041236/load-sparse-scipy-matrix-into-existing-numpy-dense-matrix>
.)
Thanks,
Conrad lee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120205/e06dd63c/attachment.html
More information about the SciPy-User
mailing list