[Numpy-discussion] numpy.mean still broken for largefloat32arrays

alex argriffi at ncsu.edu
Mon Jul 28 09:21:15 EDT 2014


On Mon, Jul 28, 2014 at 8:46 AM, Sebastian Berg
<sebastian at sipsolutions.net> wrote:
> On Mo, 2014-07-28 at 14:37 +0200, Eelco Hoogendoorn wrote:
>> To rephrase my most pressing question: may np.ones((N,2)).mean(0) and
>> np.ones((2,N)).mean(1) produce different results with the
>> implementation in the current master? If so, I think that would be
>> very much regrettable; and if this is a minority opinion, I do hope
>> that at least this gets documented in a most explicit manner.
>>
>
> This will always give you different results. Though in master. the
> difference is more likely to be large, since (often the second one)
> maybe be less likely to run into bigger numerical issues.

Are you sure they always give different results?  Notice that
np.ones((N,2)).mean(0)
np.ones((2,N)).mean(1)
compute means of different axes on transposed arrays so these
differences 'cancel out'.

My understanding of the question is to clarify how numpy reduction
algorithms are special-cased for the fast axis vs. other axes.



More information about the NumPy-Discussion mailing list