David Cournapeau wrote: > > Unless you are executing this on a gigantic computer, this won't work > very well: you are asking to create an array which has ~ 2e5^2 elements, > that is around 40 Gb. > > There is a bug, but the bug happens at the above line: the zeros call > did not fail whereas it should have. It is likely caused because the > number of elements cannot fit into a 32 bits integers, which means it > overflows: > > import numpy as np > n , m = 1e5,1e5 > a = np.zeros((n, m), np.int8) > assert a.size == n * m > > Will raise an assertion error (n * m is just big enough to not fit into > a 32 bits integer in this case). >
I forgot to add: this is a bug in numpy, you should not get a segmentation fault, but it would not work anyway (because you are asking for a too big array) :) cheers, David _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
