thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

column mean is not invariant to row permutation (migrated from Trac #1957) #3505

Closed thouis closed 11 years ago

thouis commented 11 years ago

Original ticket http://projects.scipy.org/numpy/ticket/1957 Reported 2011-09-29 by trac user john200p4, assigned to unknown.

Hello. I noticed this behavior and do not know if it is a bug. Given a large matrix, the column means will be slightly different depending on the permutation of the rows. For example:

a = random.rand(2300,20) ii = random.permutation(2300) b = a[ii].copy()

abs(a.mean(0) - b.mean(0)).max() 1.3322676295501878e-15

abs(a.mean(0) - b[argsort(ii)].mean(0)).max() 0.0

thouis commented 11 years ago

Comment in Trac by trac user john200p4, 2011-09-29

One more thing. I should have mentioned that my numpy version is: 2.0.0.dev8374

Thanks, John

thouis commented 11 years ago

Comment in Trac by atmention:pv, 2011-09-29

Not a bug, this sort of things are to be expected when dealing with floating point numbers. http://floating-point-gui.de/