[SciPy-user] sparse csr_matrix memeory error

Dinesh B Vadhia dineshbvadhia@hotmail....
Sun Aug 10 16:29:24 CDT 2008


I'm obtaining a memory error when creating a large sparse csr matrix as follows:

I = 680000
J = 900000
nnz = 72000000

row = numpy.empty(nnz, dtype='intc')
column = numpy.empty(nnz, dtype='intc')
# read (i,j) data into row and column
data = scipy.ones(nnz, dtype='intc')
A = sparse.csr_matrix((data, (row, column)), shape=(I,J))

The traceback is:

Traceback (most recent call last):
  File "C:\... \ijdata.py", line 72, in <module>
    A = sparse.csr_matrix((data, (row, column)), shape=(I,J))
  File "C:\Python25\Lib\site-packages\scipy\sparse\compressed.py", line 55, in __init__
    other = self.__class__( coo_matrix(arg1, shape=shape) )
  File "C:\Python25\Lib\site-packages\scipy\sparse\compressed.py", line 39, in __init__
    arg1 = arg1.asformat(self.format)
  File "C:\Python25\Lib\site-packages\scipy\sparse\base.py", line 211, in asformat
    return getattr(self,'to' + format)()
  File "C:\Python25\Lib\site-packages\scipy\sparse\coo.py", line 278, in tocsr
    indices = empty(self.nnz, dtype=intc)
MemoryError

I'm running the program under Windows XP with over 2gb memory.  Any thoughts on what the problem is?

Dinesh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080810/d5b580d1/attachment.html 


More information about the SciPy-user mailing list