开发者

Max element/size of a numpy matrix?

what is the max element/case of a numpy matrix or what is the maximal size of a numpy matrix?

the code above returns memory error at variable matrix size...so from what envir开发者_如何学运维onmental thing does it depend (number of sequential amount of memory available?)?

for ret in xrange(5000,7000,50):

   res = []
   for x in xrange(ret):
       temp=[]
       for y in xrange(ret):
           temp.append(random.random())
       res.append(temp)

  print "r"
  r = numpy.mat(res)
  print "s"
  s = numpy.mat(res,dtype='f4')
  print "t"
  w = numpy.mat(res,dtype('f8'))

question: when and why did it return "memory error"?

ps: i use last python and numpy available on windows (yes I know...) 7 64bit.


See Upper memory limit?.

As for when it returned a memory error, the answer is when allocating memory for one of the large objects. It could be any one, because you'll be at a higher amount of memory than ever before by the time you allocate the later rows of res, since the numpy matrixes don't get garbage collected until after you've pointed r, s, or t at another object (the new matrix created on the next iteration).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜