[Numpy-discussion] segmentation fault

Charles R Harris charlesr.harris at gmail.com
Wed May 28 13:37:42 EDT 2008


On Wed, May 28, 2008 at 11:22 AM, Stéfan van der Walt <stefan at sun.ac.za>
wrote:

> 2008/5/28 Charles R Harris <charlesr.harris at gmail.com>:
> > It's shape related.
> >
> > In [7]: x = numpy.random.rand(5,2)
> >
> > In [8]: y = ones((5,2))
> >
> > In [9]: x.cumsum(None,out=y)
> > Out[9]:
> > array([[ 0.76943981,  1.        ],
> >        [ 1.12678411,  1.        ],
> >        [ 1.69498328,  1.        ],
> >        [ 2.50560628,  1.        ],
> >        [ 3.23050034,  1.        ]])
>
> Yes, that first column doesn't stop there :)
>
> So, would it work to use a flattened view on the array in ufuncobject.c?


I think the bug is not raising an error on shape mismatch, the assumption on
the first index follows from that. For the out=x parameter, I propose the
rules:

1) x must have the shape of the expected output (1D in this case)
2) x must have the same type as the expected output (currently cast)

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080528/fa566317/attachment.html>


More information about the NumPy-Discussion mailing list