Hi, (I saw some discussion of this on the mailing list, but was not sure if there was a solution reached...) 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 [EMAIL PROTECTED] 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 [email protected] https://lists.sourceforge.net/lists/listinfo/numpy-discussion
