[Numpy-discussion] segmentation fault

Travis E. Oliphant oliphant@enthought....
Wed May 28 16:08:14 CDT 2008


Charles R Harris wrote:
>
>
> On Wed, May 28, 2008 at 11:22 AM, Stéfan van der Walt 
> <stefan@sun.ac.za <mailto:stefan@sun.ac.za>> wrote:
>
>     2008/5/28 Charles R Harris <charlesr.harris@gmail.com
>     <mailto:charlesr.harris@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)
+1
> 2) x must have the same type as the expected output (currently cast)
-lots





More information about the Numpy-discussion mailing list