[Numpy-discussion] Segmentation fault
Anne-Sophie Sertier
sertier@biomserv.univ-lyon1...
Thu Apr 17 06:04:24 CDT 2008
Thanks a lot for your answer ! I will try another way !
Anne-Sophie
David Cournapeau a écrit :
> 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
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>
--
Anne-Sophie Sertier, Doctorante monitrice
UMR 5558, Laboratoire de Biométrie et Biologie Evolutive
Université Lyon1, bât G. Mendel 2è étage
43 bd du 11 novembre 1918
69622 Villeurbanne cedex
France
Tel: 04 26 23 44 76
More information about the Numpy-discussion
mailing list