[Numpy-discussion] A random.normal function with stdev as array
oliphant.travis at ieee.org
Thu Apr 6 02:38:04 CDT 2006
John Byrnes wrote:
> Hi Eric,
> In the past , I've done things like
> normdist = lambda x: numpy.random.normal(0,x)
> vecnormal = numpy.vectorize(normdist)
> stdev = numpy.array([1.1,1.2,1.0,2.2])
> result = vecnormal(stdev)
> This works fine for up to 10k elements for stdev for some reason.
> Any larger then that and i get a Bus error on my PPC mac and a segfault on
> my x86 linux box.
This needs to be tracked down. It looks like some-kind of error is not
being caught correctly. You should not get a segfault. Could you
provide a stack-trace when the problem occurs?
One issue is that vectorize is using object arrays under the covers
which is consuming roughly 2x the memory than you may think. An
object array is created and the function is called for every element.
This object array is then converted to a number type after the fact.
The segfault should be tracked down in any case.
More information about the Numpy-discussion