On Tue, Jan 24, 2012 at 7:21 PM, eat <e.antero.ta...@gmail.com> wrote:
> Hi > > On Wed, Jan 25, 2012 at 1:21 AM, Kathleen M Tacina < > kathleen.m.tac...@nasa.gov> wrote: > >> ** >> I found something similar, with a very simple example. >> >> On 64-bit linux, python 2.7.2, numpy development version: >> >> In [22]: a = 4000*np.ones((1024,1024),dtype=np.float32) >> >> In [23]: a.mean() >> Out[23]: 4034.16357421875 >> >> In [24]: np.version.full_version >> Out[24]: '2.0.0.dev-55472ca' >> >> >> But, a Windows XP machine running python 2.7.2 with numpy 1.6.1 gives: >> >>>a = np.ones((1024,1024),dtype=np.float32) >> >>>a.mean() >> 4000.0 >> >>>np.version.full_version >> '1.6.1' >> > This indeed looks very nasty, regardless of whether it is a version or > platform related problem. > Looks like platform specific, same result as -eat Windows 7, Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32 >>> a = np.ones((1024,1024),dtype=np.float32) >>> a.mean() 1.0 >>> (4000*a).dtype dtype('float32') >>> (4000*a).mean() 4000.0 >>> b = np.load("data.npy") >>> b.mean() 3045.7471999999998 >>> b.shape (1000, 1000) >>> b.mean(0).mean(0) 3045.7472499999999 >>> _.dtype dtype('float64') >>> b.dtype dtype('float32') >>> b.mean(dtype=np.float32) 3045.7471999999998 Josef > > -eat > >> >> >> >> On Tue, 2012-01-24 at 17:12 -0600, eat wrote: >> >> Hi, >> >> >> >> Oddly, but numpy 1.6 seems to behave more consistent manner: >> >> >> >> In []: sys.version >> >> Out[]: '2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit >> (Intel)]' >> >> In []: np.version.version >> >> Out[]: '1.6.0' >> >> >> >> In []: d= np.load('data.npy') >> >> In []: d.dtype >> >> Out[]: dtype('float32') >> >> >> >> In []: d.mean() >> >> Out[]: 3045.7471999999998 >> >> In []: d.mean(dtype= np.float32) >> >> Out[]: 3045.7471999999998 >> >> In []: d.mean(dtype= np.float64) >> >> Out[]: 3045.747251076416 >> >> In []: (d- d.min()).mean()+ d.min() >> >> Out[]: 3045.7472508750002 >> >> In []: d.mean(axis= 0).mean() >> >> Out[]: 3045.7472499999999 >> >> In []: d.mean(axis= 1).mean() >> >> Out[]: 3045.7472499999999 >> >> >> >> Or does the results of calculations depend more on the platform? >> >> >> >> >> >> My 2 cents, >> >> eat >> >> -- >> -------------------------------------------------- >> Kathleen M. Tacina >> NASA Glenn Research Center >> MS 5-10 >> 21000 Brookpark Road >> Cleveland, OH 44135 >> Telephone: (216) 433-6660 >> Fax: (216) 433-5802 >> -------------------------------------------------- >> >> >> _______________________________________________ >> NumPy-Discussion mailing list >> NumPy-Discussion@scipy.org >> http://mail.scipy.org/mailman/listinfo/numpy-discussion >> >> > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion