[Numpy-discussion] dtype error in cumsum
ndarray at mac.com
Mon Jul 3 15:40:53 CDT 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
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)
> (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
> 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__
> ->> a = numpy.arange(10002)
> ->> a.cumsum(dtype='f4')[-1]
> ->> a.cumsum(dtype='f8')[-1]
> ->> a.cumsum()[-1]
> ->> a.sum()
> ->> a.sum(dtype='f8')
> 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
> 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
> 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
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
More information about the Numpy-discussion