[Numpy-discussion] dtype error in cumsum

Sasha ndarray at mac.com
Mon Jul 3 16:40:53 EDT 2006


It did get through all right. SF is a mess.  In any case what you
observe is clearly a bug.  Looks like uninitialized memory somewhere.
Please file a bug report at
http://projects.scipy.org/scipy/numpy/newticket .

On 7/3/06, Nikhil Padmanabhan <npadmana at princeton.edu> wrote:
> (I sent the following from my gmail account, but that does not seem
> to have been accepted by sourceforge -- apologies in advance if it
> shows up twice)
>
> Hi,
>
> (I saw some discussion of this on the mailing list, but was not sure
> if there was a solution reached, so I thought I'd ask again....) If I
> try to use cumsum on a numpy array with the dtype keyword, I get the
> wrong answer if dtype does not match that of the array. More
> specifically,
>
> Python 2.4.3 (#1, Apr  3 2006, 18:07:18)
> [GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> ->> import numpy
> ->> numpy.__version__
> '0.9.9.2727'
> ->> a = numpy.arange(10002)
> ->> a.cumsum(dtype='f4')[-1]
> 0.0
> ->> a.cumsum(dtype='f8')[-1]
> 0.0
> ->> a.cumsum()[-1]
> 50015001
> ->> a.sum()
> 50015001
> ->> a.sum(dtype='f8')
> 50015001.0
>
> Note that this only seems to affect cumsum(); sum() works just fine.
> And cumsum works fine for small arrays....
>
> Am I misunderstanding what the dtype keyword in cumsum is, or doing
> something silly? I should not be overflowing any type bounds (I
> think...)
>
> This is with the SVN numpy, on an iBook G4 running OS X 10.4.6
>
> Thanks in advance,
> -- Nikhil
>
> ------------------------------------
> Nikhil Padmanabhan
> npadmana at princeton.edu
> http://wwwphy.princeton.edu/~npadmana
> nikhil@(609) 258-4355
>
>
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>




More information about the NumPy-Discussion mailing list