[Numpy-discussion] MemoryError for computing eigen-vector on 10, 000*10, 000 matrix

David Cournapeau david@ar.media.kyoto-u.ac...
Tue Apr 28 23:46:22 CDT 2009


Zhenxin Zhan wrote:
> Hello,
>  
> I am a new learner of Numpy. From 'numpybook',  I use
> numpy.linalg.eig(A) to calculate a matrix 2,000*2,000 and it works well.
>  
> But, when I calculate eigen vector for 10,000*10,000 matrix, there is
> 'MemoryError' error message in statement numpy.array(...).  My laptop
> has 4GB memory.

Which OS are you using ? If your OS is 32 bits, you won't be able to use
4 Gb for you python process, and a 10000x10000 matrix is big (the matrix
alone takes ~750 Mb of memory). If that's an option, you could also try
single precision instead of the default double precision:

import numpy as np
A = np.array(...., dtype=np.float32)
np.linalg.eig(A)

cheers,

David


More information about the Numpy-discussion mailing list